diff options
author | Jeremy Allison <jra@samba.org> | 2004-03-15 21:45:45 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-03-15 21:45:45 +0000 |
commit | 834d816caf9cd6318da00febde50d9233469dac2 (patch) | |
tree | 3abb07e54e591c56d6ccf1d06dd31aaa36a6a092 | |
parent | 12f3f0268c49c9393ff4cd97cfcd802e6b61bbea (diff) | |
download | samba-834d816caf9cd6318da00febde50d9233469dac2.tar.gz |
Use "unix netbios name" type unstring - 64 bytes long to manipulate netbios
names in nmbd. Allows conversion from dos codepage mb strings (ie. SJIS) to
expand to utf8 size on read.
Jeremy.
-rw-r--r-- | source/include/nameserv.h | 8 | ||||
-rw-r--r-- | source/include/safe_string.h | 1 | ||||
-rw-r--r-- | source/include/smb.h | 3 | ||||
-rw-r--r-- | source/nmbd/asyncdns.c | 9 | ||||
-rw-r--r-- | source/nmbd/nmbd_become_dmb.c | 8 | ||||
-rw-r--r-- | source/nmbd/nmbd_become_lmb.c | 12 | ||||
-rw-r--r-- | source/nmbd/nmbd_browserdb.c | 4 | ||||
-rw-r--r-- | source/nmbd/nmbd_browsesync.c | 22 | ||||
-rw-r--r-- | source/nmbd/nmbd_elections.c | 12 | ||||
-rw-r--r-- | source/nmbd/nmbd_incomingdgrams.c | 44 | ||||
-rw-r--r-- | source/nmbd/nmbd_incomingrequests.c | 10 | ||||
-rw-r--r-- | source/nmbd/nmbd_logonnames.c | 4 | ||||
-rw-r--r-- | source/nmbd/nmbd_mynames.c | 2 | ||||
-rw-r--r-- | source/nmbd/nmbd_namelistdb.c | 4 | ||||
-rw-r--r-- | source/nmbd/nmbd_nameregister.c | 6 | ||||
-rw-r--r-- | source/nmbd/nmbd_packets.c | 4 | ||||
-rw-r--r-- | source/nmbd/nmbd_processlogon.c | 4 | ||||
-rw-r--r-- | source/nmbd/nmbd_sendannounce.c | 4 | ||||
-rw-r--r-- | source/nmbd/nmbd_synclists.c | 12 | ||||
-rw-r--r-- | source/nmbd/nmbd_winsproxy.c | 4 | ||||
-rw-r--r-- | source/nmbd/nmbd_winsserver.c | 8 | ||||
-rw-r--r-- | source/nmbd/nmbd_workgroupdb.c | 6 |
22 files changed, 97 insertions, 94 deletions
diff --git a/source/include/nameserv.h b/source/include/nameserv.h index 5362960d62b..ec3d56c06b7 100644 --- a/source/include/nameserv.h +++ b/source/include/nameserv.h @@ -226,8 +226,8 @@ struct name_record { /* Browser cache for synchronising browse lists. */ struct browse_cache_record { ubi_dlNode node[1]; - fstring lmb_name; - fstring work_group; + unstring lmb_name; + unstring work_group; struct in_addr ip; time_t sync_time; time_t death_time; /* The time the record must be removed. */ @@ -265,9 +265,9 @@ struct work_record { enum logon_state log_state; /* Work group info. */ - fstring work_group; + unstring work_group; int token; /* Used when communicating with backup browsers. */ - fstring local_master_browser_name; /* Current local master browser. */ + unstring local_master_browser_name; /* Current local master browser. */ /* Announce info. */ time_t lastannounce_time; diff --git a/source/include/safe_string.h b/source/include/safe_string.h index cb3f37c4841..b22c5efcc99 100644 --- a/source/include/safe_string.h +++ b/source/include/safe_string.h @@ -139,6 +139,7 @@ size_t __unsafe_string_function_usage_here_char__(void); #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1) #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1) #define nstrcpy(d,s) safe_strcpy((d), (s),sizeof(nstring)-1) +#define unstrcpy(d,s) safe_strcpy((d), (s),sizeof(unstring)-1) /* the addition of the DEVELOPER checks in safe_strcpy means we must * update a lot of code. To make this a little easier here are some diff --git a/source/include/smb.h b/source/include/smb.h index 500aff997e9..6c2f74e3b9e 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -1505,7 +1505,10 @@ struct cnotify_fns { #include "smb_macros.h" #define MAX_NETBIOSNAME_LEN 16 +/* DOS character, NetBIOS namestring. Type used on the wire. */ typedef char nstring[MAX_NETBIOSNAME_LEN]; +/* Unix character, NetBIOS namestring. Type used to manipulate name in nmbd. */ +typedef char unstring[MAX_NETBIOSNAME_LEN*4]; /* A netbios name structure. */ struct nmb_name { diff --git a/source/nmbd/asyncdns.c b/source/nmbd/asyncdns.c index dafbff7af20..653cb97fbb0 100644 --- a/source/nmbd/asyncdns.c +++ b/source/nmbd/asyncdns.c @@ -27,7 +27,7 @@ static struct name_record *add_dns_result(struct nmb_name *question, struct in_addr addr) { int name_type = question->name_type; - fstring qname; + unstring qname; pull_ascii_nstring(qname, sizeof(qname), question->name); @@ -81,7 +81,7 @@ int asyncdns_fd(void) static void asyncdns_process(void) { struct query_record r; - fstring qname; + unstring qname; DEBUGLEVEL = -1; @@ -89,8 +89,7 @@ static void asyncdns_process(void) if (read_data(fd_in, (char *)&r, sizeof(r)) != sizeof(r)) break; - fstrcpy(qname, r.name.name); - + pull_ascii_nstring( qname, sizeof(qname), r.name.name); r.result.s_addr = interpret_addr(qname); if (write_data(fd_out, (char *)&r, sizeof(r)) != sizeof(r)) @@ -321,7 +320,7 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question, struct name_record **n) { struct in_addr dns_ip; - nstring qname; + unstring qname; pull_ascii_nstring(qname, question->name); diff --git a/source/nmbd/nmbd_become_dmb.c b/source/nmbd/nmbd_become_dmb.c index c9b0a225807..fb1fb33a818 100644 --- a/source/nmbd/nmbd_become_dmb.c +++ b/source/nmbd/nmbd_become_dmb.c @@ -37,7 +37,7 @@ static void become_domain_master_fail(struct subnet_record *subrec, struct response_record *rrec, struct nmb_name *fail_name) { - fstring failname; + unstring failname; struct work_record *work; struct server_record *servrec; @@ -80,7 +80,7 @@ static void become_domain_master_stage2(struct subnet_record *subrec, uint16 nb_flags, int ttl, struct in_addr registered_ip) { - fstring regname; + unstring regname; struct work_record *work; struct server_record *servrec; @@ -200,7 +200,7 @@ static void become_domain_master_query_success(struct subnet_record *subrec, struct nmb_name *nmbname, struct in_addr ip, struct res_rec *rrec) { - fstring name; + unstring name; pull_ascii_nstring(name, sizeof(name), nmbname->name); /* If the given ip is not ours, then we can't become a domain @@ -241,7 +241,7 @@ static void become_domain_master_query_fail(struct subnet_record *subrec, struct response_record *rrec, struct nmb_name *question_name, int fail_code) { - fstring name; + unstring name; /* If the query was unicast, and the error is not NAM_ERR (name didn't exist), then this is a failure. Otherwise, not finding the name is what we want. */ diff --git a/source/nmbd/nmbd_become_lmb.c b/source/nmbd/nmbd_become_lmb.c index 8d66320f3eb..c536deb6f45 100644 --- a/source/nmbd/nmbd_become_lmb.c +++ b/source/nmbd/nmbd_become_lmb.c @@ -33,7 +33,7 @@ extern uint16 samba_nb_type; /* Samba's NetBIOS name type. */ void insert_permanent_name_into_unicast( struct subnet_record *subrec, struct nmb_name *nmbname, uint16 nb_type ) { - fstring name; + unstring name; struct name_record *namerec; if((namerec = find_name_on_subnet(unicast_subnet, nmbname, FIND_SELF_NAME)) == NULL) { @@ -135,7 +135,7 @@ static void unbecome_local_master_success(struct subnet_record *subrec, struct in_addr released_ip) { BOOL force_new_election = False; - fstring relname; + unstring relname; memcpy((char *)&force_new_election, userdata->data, sizeof(BOOL)); @@ -166,7 +166,7 @@ static void unbecome_local_master_fail(struct subnet_record *subrec, struct resp struct name_record *namerec; struct userdata_struct *userdata = rrec->userdata; BOOL force_new_election = False; - fstring failname; + unstring failname; memcpy((char *)&force_new_election, userdata->data, sizeof(BOOL)); @@ -330,7 +330,7 @@ static void become_local_master_stage2(struct subnet_record *subrec, struct server_record *sl; struct work_record *work; struct server_record *servrec; - fstring regname; + unstring regname; pull_ascii_nstring(regname, sizeof(regname), registered_name->name); work = find_workgroup_on_subnet( subrec, regname); @@ -410,7 +410,7 @@ static void become_local_master_fail2(struct subnet_record *subrec, struct response_record *rrec, struct nmb_name *fail_name) { - fstring failname; + unstring failname; struct work_record *work; DEBUG(0,("become_local_master_fail2: failed to register name %s on subnet %s. \ @@ -590,5 +590,5 @@ local_master_browser_name for workgroup %s to workgroup name.\n", } #endif - fstrcpy(work->local_master_browser_name, newname); + unstrcpy(work->local_master_browser_name, newname); } diff --git a/source/nmbd/nmbd_browserdb.c b/source/nmbd/nmbd_browserdb.c index d7812591569..c92513fae81 100644 --- a/source/nmbd/nmbd_browserdb.c +++ b/source/nmbd/nmbd_browserdb.c @@ -106,8 +106,8 @@ struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name, /* Allow the new lmb to miss an announce period before we remove it. */ browc->death_time = now + ( (CHECK_TIME_MST_ANNOUNCE + 2) * 60 ); - fstrcpy( browc->lmb_name, browser_name); - fstrcpy( browc->work_group, work_name); + unstrcpy( browc->lmb_name, browser_name); + unstrcpy( browc->work_group, work_name); strupper_m( browc->lmb_name ); strupper_m( browc->work_group ); diff --git a/source/nmbd/nmbd_browsesync.c b/source/nmbd/nmbd_browsesync.c index f16d8603c97..15827e21bae 100644 --- a/source/nmbd/nmbd_browsesync.c +++ b/source/nmbd/nmbd_browsesync.c @@ -102,7 +102,7 @@ As a local master browser, send an announce packet to the domain master browser. static void announce_local_master_browser_to_domain_master_browser( struct work_record *work) { pstring outbuf; - fstring myname; + unstring myname; char *p; if(ismyip(work->dmb_addr)) { @@ -120,7 +120,7 @@ static void announce_local_master_browser_to_domain_master_browser( struct work_ SCVAL(p,0,ANN_MasterAnnouncement); p++; - fstrcpy(myname, global_myname()); + unstrcpy(myname, global_myname()); strupper_m(myname); myname[15]='\0'; /* The call below does CH_UNIX -> CH_DOS conversion. JRA */ @@ -146,7 +146,7 @@ As a local master browser, do a sync with a domain master browser. static void sync_with_dmb(struct work_record *work) { - fstring dmb_name; + unstring dmb_name; if( DEBUGLVL( 2 ) ) { dbgtext( "sync_with_dmb:\n" ); @@ -156,7 +156,7 @@ static void sync_with_dmb(struct work_record *work) dbgtext( "for workgroup %s\n", work->work_group ); } - pull_ascii_nstring(dmb_name, sizeof(fstring), work->dmb_name.name); + pull_ascii_nstring(dmb_name, sizeof(dmb_name), work->dmb_name.name); sync_browse_lists(work, dmb_name, work->dmb_name.name_type, work->dmb_addr, False, True); } @@ -197,7 +197,7 @@ static void domain_master_node_status_success(struct subnet_record *subrec, p += 1; while (numnames--) { - fstring qname; + unstring qname; uint16 nb_flags; int name_type; @@ -278,7 +278,7 @@ static void find_domain_master_name_query_success(struct subnet_record *subrec, struct nmb_name nmbname; struct userdata_struct *userdata; size_t size = sizeof(struct userdata_struct) + sizeof(fstring)+1; - fstring qname; + unstring qname; pull_ascii_nstring(qname, sizeof(qname), q_name->name); if( !(work = find_workgroup_on_subnet(subrec, qname)) ) { @@ -399,7 +399,7 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub struct in_addr from_ip) { struct work_record *work; - fstring server_name; + unstring server_name; server_name[0] = 0; @@ -420,7 +420,7 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub p += 1; while (numnames--) { - fstring qname; + unstring qname; uint16 nb_flags; int name_type; @@ -434,7 +434,7 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub if(!(nb_flags & NB_GROUP) && (name_type == 0x00) && server_name[0] == 0) { /* this is almost certainly the server netbios name */ - fstrcpy(server_name, qname); + unstrcpy(server_name, qname); continue; } @@ -460,7 +460,7 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub return; /* remember who the master is */ - fstrcpy(work->local_master_browser_name, server_name); + unstrcpy(work->local_master_browser_name, server_name); make_nmb_name(&nmbname, server_name, 0x20); work->dmb_name = nmbname; work->dmb_addr = from_ip; @@ -647,7 +647,7 @@ void sync_all_dmbs(time_t t) /* sync with a probability of 1/count */ for (work=unicast_subnet->workgrouplist; work; work = work->next) { if (strcmp(lp_workgroup(), work->work_group)) { - fstring dmb_name; + unstring dmb_name; if (((unsigned)sys_random()) % count != 0) continue; diff --git a/source/nmbd/nmbd_elections.c b/source/nmbd/nmbd_elections.c index 24026d7cd9e..470cf4277b5 100644 --- a/source/nmbd/nmbd_elections.c +++ b/source/nmbd/nmbd_elections.c @@ -34,7 +34,7 @@ static void send_election_dgram(struct subnet_record *subrec, const char *workgr uint32 criterion, int timeup,const char *server_name) { pstring outbuf; - fstring srv_name; + unstring srv_name; char *p; DEBUG(2,("send_election_dgram: Sending election packet for workgroup %s on subnet %s\n", @@ -49,7 +49,7 @@ static void send_election_dgram(struct subnet_record *subrec, const char *workgr SIVAL(p,1,criterion); SIVAL(p,5,timeup*1000); /* ms - Despite what the spec says. */ p += 13; - fstrcpy(srv_name, server_name); + unstrcpy(srv_name, server_name); strupper_m(srv_name); /* The following call does UNIX -> DOS charset conversion. */ pstrcpy_base(p, srv_name, outbuf); @@ -70,7 +70,7 @@ static void check_for_master_browser_success(struct subnet_record *subrec, struct nmb_name *answer_name, struct in_addr answer_ip, struct res_rec *rrec) { - fstring aname; + unstring aname; pull_ascii_nstring(aname, sizeof(aname), answer_name->name); DEBUG(3,("check_for_master_browser_success: Local master browser for workgroup %s exists at \ IP %s (just checking).\n", aname, inet_ntoa(answer_ip) )); @@ -85,7 +85,7 @@ static void check_for_master_browser_fail( struct subnet_record *subrec, struct nmb_name *question_name, int fail_code) { - fstring workgroup_name; + unstring workgroup_name; struct work_record *work; pull_ascii_nstring(workgroup_name,sizeof(workgroup_name),question_name->name); @@ -263,9 +263,9 @@ void process_election(struct subnet_record *subrec, struct packet_struct *p, cha int version = CVAL(buf,0); uint32 criterion = IVAL(buf,1); int timeup = IVAL(buf,5)/1000; - fstring server_name; + unstring server_name; struct work_record *work; - fstring workgroup_name; + unstring workgroup_name; pull_ascii_nstring(server_name, sizeof(server_name), buf+13); pull_ascii_nstring(workgroup_name, sizeof(workgroup_name), dgram->dest_name.name); diff --git a/source/nmbd/nmbd_incomingdgrams.c b/source/nmbd/nmbd_incomingdgrams.c index 1450610e190..53b19471572 100644 --- a/source/nmbd/nmbd_incomingdgrams.c +++ b/source/nmbd/nmbd_incomingdgrams.c @@ -97,13 +97,13 @@ void process_host_announce(struct subnet_record *subrec, struct packet_struct *p { struct dgram_packet *dgram = &p->packet.dgram; int ttl = IVAL(buf,1)/1000; - fstring announce_name; + unstring announce_name; uint32 servertype = IVAL(buf,23); fstring comment; struct work_record *work; struct server_record *servrec; - fstring work_name; - fstring source_name; + unstring work_name; + unstring source_name; START_PROFILE(host_announce); @@ -144,7 +144,7 @@ void process_host_announce(struct subnet_record *subrec, struct packet_struct *p */ if(strequal(work_name, global_myname())) - fstrcpy(work_name,lp_workgroup()); + unstrcpy(work_name,lp_workgroup()); /* * We are being very agressive here in adding a workgroup @@ -198,12 +198,12 @@ void process_workgroup_announce(struct subnet_record *subrec, struct packet_stru { struct dgram_packet *dgram = &p->packet.dgram; int ttl = IVAL(buf,1)/1000; - fstring workgroup_announce_name; - fstring master_name; + unstring workgroup_announce_name; + unstring master_name; uint32 servertype = IVAL(buf,23); struct work_record *work; - fstring source_name; - fstring dest_name; + unstring source_name; + unstring dest_name; START_PROFILE(workgroup_announce); @@ -255,13 +255,13 @@ void process_local_master_announce(struct subnet_record *subrec, struct packet_s { struct dgram_packet *dgram = &p->packet.dgram; int ttl = IVAL(buf,1)/1000; - fstring server_name; + unstring server_name; uint32 servertype = IVAL(buf,23); fstring comment; - fstring work_name; + unstring work_name; struct work_record *work; struct server_record *servrec; - fstring source_name; + unstring source_name; START_PROFILE(local_master_announce); @@ -369,7 +369,7 @@ done: void process_master_browser_announce(struct subnet_record *subrec, struct packet_struct *p,char *buf) { - fstring local_master_name; + unstring local_master_name; struct work_record *work; struct browse_cache_record *browrec; @@ -425,11 +425,11 @@ void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct int osmajor=CVAL(buf,5); /* major version of node software */ int osminor=CVAL(buf,6); /* minor version of node software */ int ttl = SVAL(buf,7); - fstring announce_name; + unstring announce_name; struct work_record *work; struct server_record *servrec; - fstring work_name; - fstring source_name; + unstring work_name; + unstring source_name; fstring comment; char *s = buf+9; @@ -479,7 +479,7 @@ originate from OS/2 Warp client. Ignoring packet.\n")); */ if(strequal(work_name, global_myname())) - fstrcpy(work_name,lp_workgroup()); + unstrcpy(work_name,lp_workgroup()); /* * We are being very agressive here in adding a workgroup @@ -541,11 +541,11 @@ static void send_backup_list_response(struct subnet_record *subrec, char outbuf[1024]; char *p, *countptr; unsigned int count = 0; - fstring send_to_namestr; + unstring send_to_namestr; #if 0 struct server_record *servrec; #endif - fstring myname; + unstring myname; memset(outbuf,'\0',sizeof(outbuf)); @@ -565,7 +565,7 @@ static void send_backup_list_response(struct subnet_record *subrec, /* We always return at least one name - our own. */ count = 1; - fstrcpy(myname, global_myname()); + unstrcpy(myname, global_myname()); strupper_m(myname); myname[15]='\0'; push_pstring_base(p, myname, outbuf); @@ -642,7 +642,7 @@ void process_get_backup_list_request(struct subnet_record *subrec, unsigned char max_number_requested = CVAL(buf,0); uint32 token = IVAL(buf,1); /* Sender's key index for the workgroup. */ int name_type = dgram->dest_name.name_type; - fstring workgroup_name; + unstring workgroup_name; struct subnet_record *search_subrec = subrec; START_PROFILE(get_backup_list); @@ -774,7 +774,7 @@ void process_announce_request(struct subnet_record *subrec, struct packet_struct { struct dgram_packet *dgram = &p->packet.dgram; struct work_record *work; - fstring workgroup_name; + unstring workgroup_name; START_PROFILE(announce_request); @@ -814,7 +814,7 @@ done: void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf) { struct dgram_packet *dgram = &p->packet.dgram; - fstring workgroup_name; + unstring workgroup_name; START_PROFILE(lm_announce_request); diff --git a/source/nmbd/nmbd_incomingrequests.c b/source/nmbd/nmbd_incomingrequests.c index d43cefc0df0..9214594096c 100644 --- a/source/nmbd/nmbd_incomingrequests.c +++ b/source/nmbd/nmbd_incomingrequests.c @@ -58,7 +58,7 @@ void process_name_release_request(struct subnet_record *subrec, struct nmb_packet *nmb = &p->packet.nmb; struct in_addr owner_ip; struct nmb_name *question = &nmb->question.question_name; - fstring qname; + unstring qname; BOOL bcast = nmb->header.nm_flags.bcast; uint16 nb_flags = get_nb_flags(nmb->additional->rdata); BOOL group = (nb_flags & NB_GROUP) ? True : False; @@ -275,7 +275,7 @@ We put our own names first, then in alphabetical order. static int status_compare(char *n1,char *n2) { - fstring name1, name2; + unstring name1, name2; int l1,l2,l3; memset(name1, '\0', sizeof(name1)); @@ -300,7 +300,7 @@ static int status_compare(char *n1,char *n2) (l1!=l3 || strncmp(n1,global_myname(),l3) != 0)) return 1; - return memcmp(n1,n2,sizeof(fstring)); + return memcmp(n1,n2,sizeof(name1)); } /**************************************************************************** @@ -310,7 +310,7 @@ static int status_compare(char *n1,char *n2) void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p) { struct nmb_packet *nmb = &p->packet.nmb; - fstring qname; + unstring qname; int ques_type = nmb->question.question_name.name_type; char rdata[MAX_DGRAM_SIZE]; char *countptr, *buf, *bufend, *buf0; @@ -344,7 +344,7 @@ subnet %s - name not found.\n", nmb_namestr(&nmb->question.question_name), while (buf < bufend) { if( (namerec->data.source == SELF_NAME) || (namerec->data.source == PERMANENT_NAME) ) { int name_type = namerec->name.name_type; - fstring name; + unstring name; pull_ascii_nstring(name, sizeof(name), namerec->name.name); strupper_m(name); diff --git a/source/nmbd/nmbd_logonnames.c b/source/nmbd/nmbd_logonnames.c index b6e841139f9..e4264305911 100644 --- a/source/nmbd/nmbd_logonnames.c +++ b/source/nmbd/nmbd_logonnames.c @@ -35,7 +35,7 @@ static void become_logon_server_fail(struct subnet_record *subrec, struct response_record *rrec, struct nmb_name *fail_name) { - fstring failname; + unstring failname; struct work_record *work; struct server_record *servrec; @@ -76,7 +76,7 @@ static void become_logon_server_success(struct subnet_record *subrec, uint16 nb_flags, int ttl, struct in_addr registered_ip) { - fstring reg_name; + unstring reg_name; struct work_record *work; struct server_record *servrec; diff --git a/source/nmbd/nmbd_mynames.c b/source/nmbd/nmbd_mynames.c index 83a8361ed98..07247d5495e 100644 --- a/source/nmbd/nmbd_mynames.c +++ b/source/nmbd/nmbd_mynames.c @@ -93,7 +93,7 @@ static void insert_refresh_name_into_unicast( struct subnet_record *subrec, } if((namerec = find_name_on_subnet(unicast_subnet, nmbname, FIND_SELF_NAME)) == NULL) { - fstring name; + unstring name; pull_ascii_nstring(name, sizeof(name), nmbname->name); /* The name needs to be created on the unicast subnet. */ (void)add_name_to_subnet( unicast_subnet, name, diff --git a/source/nmbd/nmbd_namelistdb.c b/source/nmbd/nmbd_namelistdb.c index 9f89abdbb28..bb14ff7641a 100644 --- a/source/nmbd/nmbd_namelistdb.c +++ b/source/nmbd/nmbd_namelistdb.c @@ -45,7 +45,7 @@ void set_samba_nb_type(void) static void upcase_name( struct nmb_name *target, struct nmb_name *source ) { int i; - fstring targ; + unstring targ; fstring scope; if( NULL != source ) @@ -255,7 +255,7 @@ void standard_success_register(struct subnet_record *subrec, namerec = find_name_on_subnet( subrec, nmbname, FIND_SELF_NAME ); if( NULL == namerec ) { - fstring name; + unstring name; pull_ascii_nstring(name, sizeof(name), nmbname->name); add_name_to_subnet( subrec, name, nmbname->name_type, nb_flags, ttl, SELF_NAME, 1, ®istered_ip ); diff --git a/source/nmbd/nmbd_nameregister.c b/source/nmbd/nmbd_nameregister.c index 4fbdd143e1f..4e11881f063 100644 --- a/source/nmbd/nmbd_nameregister.c +++ b/source/nmbd/nmbd_nameregister.c @@ -85,7 +85,7 @@ static void register_name_response(struct subnet_record *subrec, */ #if 1 /* OLD_SAMBA_SERVER_HACK */ - fstring ans_name; + unstring ans_name; pull_ascii_nstring(ans_name, sizeof(ans_name), answer_name->name); if((nmb->header.rcode == ACT_ERR) && strequal(lp_workgroup(), ans_name) && (answer_name->name_type == 0x1b)) { @@ -418,7 +418,7 @@ static void multihomed_register_name(struct nmb_name *nmbname, uint16 nb_flags, struct subnet_record *subrec; char **wins_tags; struct in_addr *ip_list; - fstring name; + unstring name; for(subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec) ) num_ips++; @@ -476,7 +476,7 @@ void register_name(struct subnet_record *subrec, errno = 0; push_ascii_nstring(nname, name); if (errno == E2BIG) { - fstring tname; + unstring tname; pull_ascii_nstring(tname, sizeof(tname), nname); DEBUG(0,("register_name: NetBIOS name %s is too long. Truncating to %s\n", name, tname)); diff --git a/source/nmbd/nmbd_packets.c b/source/nmbd/nmbd_packets.c index b5cbaab00b7..d8b50a1b2e9 100644 --- a/source/nmbd/nmbd_packets.c +++ b/source/nmbd/nmbd_packets.c @@ -1034,7 +1034,7 @@ static void process_browse_packet(struct packet_struct *p, char *buf,int len) int command = CVAL(buf,0); struct subnet_record *subrec = find_subnet_for_dgram_browse_packet(p); char scope[64]; - fstring src_name; + unstring src_name; /* Drop the packet if it's a different NetBIOS scope, or the source is from one of our names. */ pull_ascii(scope, dgram->dest_name.scope, 64, 64, STR_TERMINATE); @@ -1121,7 +1121,7 @@ static void process_lanman_packet(struct packet_struct *p, char *buf,int len) int command = SVAL(buf,0); struct subnet_record *subrec = find_subnet_for_dgram_browse_packet(p); char scope[64]; - fstring src_name; + unstring src_name; /* Drop the packet if it's a different NetBIOS scope, or the source is from one of our names. */ diff --git a/source/nmbd/nmbd_processlogon.c b/source/nmbd/nmbd_processlogon.c index 617a7be6cb7..1d1fe75d9c6 100644 --- a/source/nmbd/nmbd_processlogon.c +++ b/source/nmbd/nmbd_processlogon.c @@ -235,7 +235,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", { fstring getdc_str; - nstring source_name; + fstring source_name; char *q = buf + 2; fstring asccomp; @@ -437,7 +437,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", send_mailslot(True, getdc, outbuf,PTR_DIFF(q,outbuf), global_myname(), 0x0, - dgram->source_name.name, + source_name, dgram->source_name.name_type, p->ip, *iface_ip(p->ip), p->port); break; diff --git a/source/nmbd/nmbd_sendannounce.c b/source/nmbd/nmbd_sendannounce.c index 87908e352cf..6e50d2f2ff4 100644 --- a/source/nmbd/nmbd_sendannounce.c +++ b/source/nmbd/nmbd_sendannounce.c @@ -525,7 +525,7 @@ void browse_sync_remote(time_t t) struct work_record *work; pstring outbuf; char *p; - fstring myname; + unstring myname; if (last_time && (t < (last_time + REMOTE_ANNOUNCE_INTERVAL))) return; @@ -558,7 +558,7 @@ for workgroup %s on subnet %s.\n", lp_workgroup(), FIRST_SUBNET->subnet_name )); SCVAL(p,0,ANN_MasterAnnouncement); p++; - fstrcpy(myname, global_myname()); + unstrcpy(myname, global_myname()); strupper_m(myname); myname[15]='\0'; push_pstring_base(p, myname, outbuf); diff --git a/source/nmbd/nmbd_synclists.c b/source/nmbd/nmbd_synclists.c index 424af1e2e3c..86f1f760fd2 100644 --- a/source/nmbd/nmbd_synclists.c +++ b/source/nmbd/nmbd_synclists.c @@ -31,8 +31,8 @@ struct sync_record { struct sync_record *next, *prev; - fstring workgroup; - fstring server; + unstring workgroup; + unstring server; pstring fname; struct in_addr ip; pid_t pid; @@ -148,8 +148,8 @@ done: ZERO_STRUCTP(s); - fstrcpy(s->workgroup, work->work_group); - fstrcpy(s->server, name); + unstrcpy(s->workgroup, work->work_group); + unstrcpy(s->server, name); s->ip = ip; slprintf(s->fname, sizeof(pstring)-1, @@ -206,7 +206,7 @@ static void complete_one(struct sync_record *s, sname, lp_max_ttl()); if (work) { /* remember who the master is */ - fstrcpy(work->local_master_browser_name, comment); + unstrcpy(work->local_master_browser_name, comment); } } return; @@ -243,7 +243,7 @@ static void complete_one(struct sync_record *s, static void complete_sync(struct sync_record *s) { XFILE *f; - fstring server, type_str; + unstring server, type_str; unsigned type; pstring comment; pstring line; diff --git a/source/nmbd/nmbd_winsproxy.c b/source/nmbd/nmbd_winsproxy.c index d91818698e8..cce168adb2f 100644 --- a/source/nmbd/nmbd_winsproxy.c +++ b/source/nmbd/nmbd_winsproxy.c @@ -30,7 +30,7 @@ static void wins_proxy_name_query_request_success( struct subnet_record *subrec, struct userdata_struct *userdata, struct nmb_name *nmbname, struct in_addr ip, struct res_rec *rrec) { - fstring name; + unstring name; struct packet_struct *original_packet; struct subnet_record *orig_broadcast_subnet; struct name_record *namerec; @@ -193,7 +193,7 @@ void make_wins_proxy_name_query_request( struct subnet_record *subrec, long *ud[(sizeof(struct userdata_struct) + sizeof(struct subrec *) + sizeof(struct packet_struct *))/sizeof(long *) + 1]; struct userdata_struct *userdata = (struct userdata_struct *)ud; - fstring qname; + unstring qname; memset(ud, '\0', sizeof(ud)); diff --git a/source/nmbd/nmbd_winsserver.c b/source/nmbd/nmbd_winsserver.c index 7279014194f..8a638402391 100644 --- a/source/nmbd/nmbd_winsserver.c +++ b/source/nmbd/nmbd_winsserver.c @@ -704,7 +704,7 @@ querying for name %s in order to replace it and this reply.\n", nmb_namestr(ques void wins_process_name_registration_request(struct subnet_record *subrec, struct packet_struct *p) { - fstring name; + unstring name; struct nmb_packet *nmb = &p->packet.nmb; struct nmb_name *question = &nmb->question.question_name; BOOL bcast = nmb->header.nm_flags.bcast; @@ -1079,7 +1079,7 @@ void wins_process_multihomed_name_registration_request( struct subnet_record *su struct in_addr from_ip; BOOL group = (nb_flags & NB_GROUP) ? True : False; struct in_addr our_fake_ip = *interpret_addr2("0.0.0.0"); - fstring qname; + unstring qname; putip((char *)&from_ip,&nmb->additional->rdata[2]); @@ -1439,7 +1439,7 @@ void wins_process_name_query_request(struct subnet_record *subrec, struct nmb_packet *nmb = &p->packet.nmb; struct nmb_name *question = &nmb->question.question_name; struct name_record *namerec = NULL; - fstring qname; + unstring qname; DEBUG(3,("wins_process_name_query: name query for name %s from IP %s\n", nmb_namestr(question), inet_ntoa(p->ip) )); @@ -1805,7 +1805,7 @@ void wins_write_database(BOOL background) DEBUGADD(4,("%2x\n", namerec->data.nb_flags )); if( namerec->data.source == REGISTER_NAME ) { - fstring name; + unstring name; pull_ascii_nstring(name, sizeof(name), namerec->name.name); x_fprintf(fp, "\"%s#%02x\" %d ", name,namerec->name.name_type, /* Ignore scope. */ (int)namerec->data.death_time); diff --git a/source/nmbd/nmbd_workgroupdb.c b/source/nmbd/nmbd_workgroupdb.c index 3efef49c042..8880cb58bb4 100644 --- a/source/nmbd/nmbd_workgroupdb.c +++ b/source/nmbd/nmbd_workgroupdb.c @@ -61,13 +61,13 @@ static struct work_record *create_workgroup(const char *name, int ttl) errno = 0; push_ascii_nstring(nname, name); if (errno == E2BIG) { - fstring tname; + unstring tname; pull_ascii_nstring(tname, sizeof(tname), nname); - fstrcpy(work->work_group,tname); + unstrcpy(work->work_group,tname); DEBUG(0,("create_workgroup: workgroup name %s is too long. Truncating to %s\n", name, tname)); } else { - fstrcpy(work->work_group,name); + unstrcpy(work->work_group,name); } work->serverlist = NULL; |