summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-01-30 05:31:07 +0000
committerJeremy Allison <jra@samba.org>1998-01-30 05:31:07 +0000
commit298c916a357c90038af35d654236aa4bdcf3cbe3 (patch)
tree1a2a062a7278ee8c8a7ec5190fc35cf6cf1803cd /source
parent8ded678ef45a4c8e45329d4103c9659a39ba40f0 (diff)
downloadsamba-298c916a357c90038af35d654236aa4bdcf3cbe3.tar.gz
samba-298c916a357c90038af35d654236aa4bdcf3cbe3.tar.xz
samba-298c916a357c90038af35d654236aa4bdcf3cbe3.zip
chgpasswd.c: Fixed char -> unsigned char issues.
nmbd_mynames.c: Stop sending more than one refresh message to a WINS server that is not replying. nmbd_responserecordsdb.c: Utility funtion to help the above. nmbd_winsserver.c: Fix for multi-homed name registration that is already present. Jeremy.
Diffstat (limited to 'source')
-rw-r--r--source/include/proto.h3
-rw-r--r--source/nmbd/nmbd_mynames.c3
-rw-r--r--source/nmbd/nmbd_responserecordsdb.c25
-rw-r--r--source/nmbd/nmbd_winsserver.c12
-rw-r--r--source/smbd/chgpasswd.c4
5 files changed, 43 insertions, 4 deletions
diff --git a/source/include/proto.h b/source/include/proto.h
index f422b8fc901..fd31db7e629 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -47,7 +47,7 @@ BOOL chgpasswd(char *name,char *oldpass,char *newpass);
BOOL chgpasswd(char *name,char *oldpass,char *newpass);
BOOL check_lanman_password(char *user, unsigned char *pass1,
unsigned char *pass2, struct smb_passwd **psmbpw);
-BOOL change_lanman_password(struct smb_passwd *smbpw, char *pass1, char *pass2);
+BOOL change_lanman_password(struct smb_passwd *smbpw, unsigned char *pass1, unsigned char *pass2);
/*The following definitions come from client.c */
@@ -710,6 +710,7 @@ struct response_record *make_response_record( struct subnet_record *subrec,
struct userdata_struct *userdata);
struct response_record *find_response_record(struct subnet_record **ppsubrec,
uint16 id);
+BOOL is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
/*The following definitions come from nmbd_sendannounce.c */
diff --git a/source/nmbd/nmbd_mynames.c b/source/nmbd/nmbd_mynames.c
index 035d1e6d3f0..9441449beda 100644
--- a/source/nmbd/nmbd_mynames.c
+++ b/source/nmbd/nmbd_mynames.c
@@ -156,7 +156,8 @@ void refresh_my_names(time_t t)
multiple refresh calls being done. We actually
deal with refresh failure in the fail_fn.
*/
- refresh_name(subrec, namerec, NULL, NULL, NULL);
+ if(!is_refresh_already_queued( subrec, namerec))
+ refresh_name(subrec, namerec, NULL, NULL, NULL);
namerec->death_time += lp_max_ttl();
namerec->refresh_time += lp_max_ttl();
}
diff --git a/source/nmbd/nmbd_responserecordsdb.c b/source/nmbd/nmbd_responserecordsdb.c
index a075284a4af..ceace36a619 100644
--- a/source/nmbd/nmbd_responserecordsdb.c
+++ b/source/nmbd/nmbd_responserecordsdb.c
@@ -236,3 +236,28 @@ matching record.\n", id));
return NULL;
}
+
+/****************************************************************************
+ Check if a refresh is queued for a particular name on a particular subnet.
+ **************************************************************************/
+
+BOOL is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec)
+{
+ struct response_record *rrec = NULL;
+
+ for (rrec = subrec->responselist; rrec; rrec = rrec->next)
+ {
+ struct packet_struct *p = rrec->packet;
+ struct nmb_packet *nmb = &p->packet.nmb;
+
+ if((nmb->header.opcode == NMB_NAME_REFRESH_OPCODE_8) ||
+ (nmb->header.opcode == NMB_NAME_REFRESH_OPCODE_9))
+ {
+ /* Yes it's a queued refresh - check if the name is correct. */
+ if(nmb_name_equal(&nmb->question.question_name, &namerec->name))
+ return True;
+ }
+ }
+
+ return False;
+}
diff --git a/source/nmbd/nmbd_winsserver.c b/source/nmbd/nmbd_winsserver.c
index 553a4e72f90..134b758c293 100644
--- a/source/nmbd/nmbd_winsserver.c
+++ b/source/nmbd/nmbd_winsserver.c
@@ -1052,6 +1052,18 @@ is one of our (WINS server) names. Denying registration.\n", namestr(question) )
}
/*
+ * If the name exists check if the IP address is already registered
+ * to that name. If so then update the ttl and reply success.
+ */
+
+ if((namerec != NULL) && find_ip_in_name_record(namerec, from_ip))
+ {
+ update_name_ttl(namerec, ttl);
+ send_wins_name_registration_response(0, ttl, p);
+ return;
+ }
+
+ /*
* If the name exists do a query to the owner
* to see if they still want the name.
*/
diff --git a/source/smbd/chgpasswd.c b/source/smbd/chgpasswd.c
index b516ec8ac8e..80c7a43750f 100644
--- a/source/smbd/chgpasswd.c
+++ b/source/smbd/chgpasswd.c
@@ -451,9 +451,9 @@ BOOL check_lanman_password(char *user, unsigned char *pass1,
no longer be valid.
************************************************************/
-BOOL change_lanman_password(struct smb_passwd *smbpw, char *pass1, char *pass2)
+BOOL change_lanman_password(struct smb_passwd *smbpw, unsigned char *pass1, unsigned char *pass2)
{
- char unenc_new_pw[16];
+ unsigned char unenc_new_pw[16];
BOOL ret;
if(smbpw == NULL)