From c1b9243c2892220b906df86d7b021d1bf18571b6 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 1 Feb 2005 20:43:14 +0000 Subject: r5165: BUG 2295: always use get_local_machine_name() rather than digging in the gloval variable 'local_machine' (This used to be commit 6a6e4af46a5c0a693a3dd9d558a4d1c1e5d72d95) --- source3/smbd/ipc.c | 11 ++++++----- source3/smbd/lanman.c | 10 ++++------ source3/smbd/msdfs.c | 7 +++---- source3/smbd/trans2.c | 5 ++--- 4 files changed, 15 insertions(+), 18 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 3f21a2ac6a..e3f6521fba 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -29,8 +29,6 @@ extern int max_send; -extern fstring local_machine; - #define NERR_notsupported 50 extern int smb_read_error; @@ -382,6 +380,7 @@ int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, int size, int unsigned int dscnt = SVAL(inbuf,smb_vwv11); unsigned int dsoff = SVAL(inbuf,smb_vwv12); unsigned int suwcnt = CVAL(inbuf,smb_vwv13); + fstring local_machine_name; START_PROFILE(SMBtrans); memset(name, '\0',sizeof(name)); @@ -543,9 +542,11 @@ int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, int size, int * WinCE wierdness.... */ - if (name[0] == '\\' && (StrnCaseCmp(&name[1],local_machine, strlen(local_machine)) == 0) && - (name[strlen(local_machine)+1] == '\\')) - name_offset = strlen(local_machine)+1; + fstrcpy( local_machine_name, get_local_machine_name() ); + + if (name[0] == '\\' && (StrnCaseCmp(&name[1],local_machine_name, strlen(local_machine_name)) == 0) && + (name[strlen(local_machine_name)+1] == '\\')) + name_offset = strlen(local_machine_name)+1; if (strnequal(&name[name_offset], "\\PIPE", strlen("\\PIPE"))) { name_offset += strlen("\\PIPE"); diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 9f2cd21425..d8c5201ce6 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -32,8 +32,6 @@ #endif #define CHECK_TYPES 0 -extern fstring local_machine; - #define NERR_Success 0 #define NERR_badpass 86 #define NERR_notsupported 50 @@ -2372,7 +2370,7 @@ static BOOL api_RNetServerGetInfo(connection_struct *conn,uint16 vuid, char *par p = *rdata; p2 = p + struct_len; if (uLevel != 20) { - srvstr_push(NULL, p,local_machine,16, + srvstr_push(NULL, p,get_local_machine_name(),16, STR_ASCII|STR_UPPER|STR_TERMINATE); } p += 16; @@ -2387,7 +2385,7 @@ static BOOL api_RNetServerGetInfo(connection_struct *conn,uint16 vuid, char *par if ((count=get_server_info(SV_TYPE_ALL,&servers,lp_workgroup()))>0) { for (i=0;ialternate_path, sizeof(pstring)-1, - "\\\\%s\\%s", local_machine, service_name); + "\\\\%s\\%s", get_local_machine_name(), service_name); cnt++; /* Now enumerate all dfs links */ diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index b5029ccd77..18fd5c946f 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -25,7 +25,6 @@ extern enum protocol_types Protocol; extern int smb_read_error; -extern fstring local_machine; extern int global_oplock_break; extern uint32 global_client_caps; extern struct current_user current_user; @@ -1825,7 +1824,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsi * Add volume serial number - hash of a combination of * the called hostname and the service name. */ - SIVAL(pdata,0,str_checksum(lp_servicename(snum)) ^ (str_checksum(local_machine)<<16) ); + SIVAL(pdata,0,str_checksum(lp_servicename(snum)) ^ (str_checksum(get_local_machine_name())<<16) ); len = srvstr_push(outbuf, pdata+l2_vol_szVolLabel, vname, -1, STR_NOALIGN); SCVAL(pdata,l2_vol_cch,len); data_len = l2_vol_szVolLabel + len; @@ -1868,7 +1867,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsi * the called hostname and the service name. */ SIVAL(pdata,8,str_checksum(lp_servicename(snum)) ^ - (str_checksum(local_machine)<<16)); + (str_checksum(get_local_machine_name())<<16)); len = srvstr_push(outbuf, pdata+18, vname, -1, STR_UNICODE); SIVAL(pdata,12,len); -- cgit