diff options
author | Jeremy Allison <jra@samba.org> | 2004-03-13 02:47:19 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-03-13 02:47:19 +0000 |
commit | 309c0a65b7de7311a5032d6a8e41c9eb039af2aa (patch) | |
tree | 58d6944a70a1db7c5740512402fa97121dbced56 | |
parent | 9a699d74efbcbbb8607c7dea2734d7acb3478896 (diff) | |
download | samba-309c0a65b7de7311a5032d6a8e41c9eb039af2aa.tar.gz samba-309c0a65b7de7311a5032d6a8e41c9eb039af2aa.tar.bz2 samba-309c0a65b7de7311a5032d6a8e41c9eb039af2aa.zip |
Ensure we don't truncate strcmps to nstring anymore...
Jeremy.
(This used to be commit b3aff7f214da97925690a5d0a887ea1b336d107a)
-rw-r--r-- | source3/lib/charcnv.c | 2 | ||||
-rw-r--r-- | source3/libsmb/nmblib.c | 5 | ||||
-rw-r--r-- | source3/nmbd/nmbd_browsesync.c | 4 | ||||
-rw-r--r-- | source3/nmbd/nmbd_elections.c | 8 | ||||
-rw-r--r-- | source3/nmbd/nmbd_serverlistdb.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_workgroupdb.c | 6 |
6 files changed, 16 insertions, 11 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index d38bfdb534..c2213c966d 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -833,6 +833,7 @@ size_t push_ascii_nstring(void *dest, const char *src) size_t i, buffer_len, dest_len; smb_ucs2_t *buffer; + conv_silent = True; buffer_len = push_ucs2_allocate(&buffer, src); if (buffer_len == (size_t)-1) { smb_panic("failed to create UCS2 buffer"); @@ -854,6 +855,7 @@ size_t push_ascii_nstring(void *dest, const char *src) ((char *)dest)[dest_len] = '\0'; SAFE_FREE(buffer); + conv_silent = False; return dest_len; } diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index bc2cca0e0e..3c25eba744 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -855,8 +855,11 @@ static int build_dgram(char *buf,struct packet_struct *p) void make_nmb_name( struct nmb_name *n, const char *name, int type) { + fstring unix_name; memset( (char *)n, '\0', sizeof(struct nmb_name) ); - push_ascii(n->name, name, sizeof(n->name), STR_TERMINATE|STR_UPPER); + fstrcpy(unix_name, name); + strupper_m(unix_name); + push_ascii(n->name, unix_name, sizeof(n->name), STR_TERMINATE); n->name_type = (unsigned int)type & 0xFF; push_ascii(n->scope, global_scope(), 64, STR_TERMINATE); } diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c index 454c349767..f16d8603c9 100644 --- a/source3/nmbd/nmbd_browsesync.c +++ b/source3/nmbd/nmbd_browsesync.c @@ -639,14 +639,14 @@ void sync_all_dmbs(time_t t) /* count how many syncs we might need to do */ for (work=unicast_subnet->workgrouplist; work; work = work->next) { - if (strncmp(lp_workgroup(), work->work_group, sizeof(nstring))) { + if (strcmp(lp_workgroup(), work->work_group)) { count++; } } /* sync with a probability of 1/count */ for (work=unicast_subnet->workgrouplist; work; work = work->next) { - if (strncmp(lp_workgroup(), work->work_group, sizeof(nstring))) { + if (strcmp(lp_workgroup(), work->work_group)) { fstring dmb_name; if (((unsigned)sys_random()) % count != 0) diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c index 882c26ce80..24026d7cd9 100644 --- a/source3/nmbd/nmbd_elections.c +++ b/source3/nmbd/nmbd_elections.c @@ -97,7 +97,7 @@ static void check_for_master_browser_fail( struct subnet_record *subrec, return; } - if (strnequal(work->work_group, lp_workgroup(), sizeof(nstring)-1)) { + if (strequal(work->work_group, lp_workgroup())) { if (lp_local_master()) { /* We have discovered that there is no local master @@ -145,7 +145,7 @@ void check_master_browser_exists(time_t t) struct work_record *work; for (work = subrec->workgrouplist; work; work = work->next) { - if (strnequal(work->work_group, workgroup_name, sizeof(nstring)-1) && !AM_LOCAL_MASTER_BROWSER(work)) { + if (strequal(work->work_group, workgroup_name) && !AM_LOCAL_MASTER_BROWSER(work)) { /* Do a name query for the local master browser on this net. */ query_name( subrec, work->work_group, 0x1d, check_for_master_browser_success, @@ -284,7 +284,7 @@ void process_election(struct subnet_record *subrec, struct packet_struct *p, cha goto done; } - if (!strnequal(work->work_group, lp_workgroup(), sizeof(nstring)-1)) { + if (!strequal(work->work_group, lp_workgroup())) { DEBUG(3,("process_election: ignoring election request for workgroup %s on subnet %s as this \ is not my workgroup.\n", work->work_group, subrec->subnet_name )); goto done; @@ -381,7 +381,7 @@ void nmbd_message_election(int msg_type, pid_t src, void *buf, size_t len) for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { struct work_record *work; for (work = subrec->workgrouplist; work; work = work->next) { - if (strnequal(work->work_group, lp_workgroup(), sizeof(nstring)-1)) { + if (strequal(work->work_group, lp_workgroup())) { work->needelection = True; work->ElectionCount=0; work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE; diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c index cdb1089a54..e6fad8319d 100644 --- a/source3/nmbd/nmbd_serverlistdb.c +++ b/source3/nmbd/nmbd_serverlistdb.c @@ -251,7 +251,7 @@ static uint32 write_this_workgroup_name( struct subnet_record *subrec, { struct subnet_record *ssub; - if(strnequal(lp_workgroup(), work->work_group, sizeof(nstring)-1)) + if(strequal(lp_workgroup(), work->work_group)) return 0; /* This is a workgroup we have seen on a broadcast subnet. All diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c index bd2737ef97..3efef49c04 100644 --- a/source3/nmbd/nmbd_workgroupdb.c +++ b/source3/nmbd/nmbd_workgroupdb.c @@ -88,7 +88,7 @@ static struct work_record *create_workgroup(const char *name, int ttl) for (subrec = FIRST_SUBNET; subrec && (t == -1); subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec)) { struct work_record *w; for (w = subrec->workgrouplist; w && t == -1; w = w->next) { - if (strnequal(w->work_group, work->work_group, sizeof(nstring)-1)) + if (strequal(w->work_group, work->work_group)) t = w->token; } } @@ -162,7 +162,7 @@ struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec, name, subrec->subnet_name)); for (ret = subrec->workgrouplist; ret; ret = ret->next) { - if (strnequal(ret->work_group,name,sizeof(nstring)-1)) { + if (strequal(ret->work_group,name)) { DEBUGADD(4, ("found.\n")); return(ret); } @@ -223,7 +223,7 @@ void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_reco { int i; - if(!strnequal(lp_workgroup(), work->work_group,sizeof(nstring)-1)) + if(!strequal(lp_workgroup(), work->work_group)) return; /* If this is a broadcast subnet then start elections on it if we are so configured. */ |