svn commit: samba r5165 - in branches/SAMBA_3_0/source/smbd: .

jerry at samba.org jerry at samba.org
Tue Feb 1 20:43:14 GMT 2005


Author: jerry
Date: 2005-02-01 20:43:14 +0000 (Tue, 01 Feb 2005)
New Revision: 5165

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5165

Log:
BUG 2295: always use get_local_machine_name() rather than digging in the gloval variable 'local_machine'
Modified:
   branches/SAMBA_3_0/source/smbd/ipc.c
   branches/SAMBA_3_0/source/smbd/lanman.c
   branches/SAMBA_3_0/source/smbd/msdfs.c
   branches/SAMBA_3_0/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/ipc.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/ipc.c	2005-02-01 19:53:58 UTC (rev 5164)
+++ branches/SAMBA_3_0/source/smbd/ipc.c	2005-02-01 20:43:14 UTC (rev 5165)
@@ -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 @@
 	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,10 +542,12 @@
 	 * 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");
 

Modified: branches/SAMBA_3_0/source/smbd/lanman.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/lanman.c	2005-02-01 19:53:58 UTC (rev 5164)
+++ branches/SAMBA_3_0/source/smbd/lanman.c	2005-02-01 20:43:14 UTC (rev 5165)
@@ -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 @@
   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 @@
 
       if ((count=get_server_info(SV_TYPE_ALL,&servers,lp_workgroup()))>0) {
 	for (i=0;i<count;i++) {
-	  if (strequal(servers[i].name,local_machine)) {
+	  if (strequal(servers[i].name,get_local_machine_name())) {
 	    servertype = servers[i].type;
 	    push_ascii(comment,servers[i].comment,sizeof(pstring),STR_TERMINATE);	    
 	  }
@@ -2460,7 +2458,7 @@
 
 
   SIVAL(p,0,PTR_DIFF(p2,*rdata)); /* host name */
-  pstrcpy(p2,local_machine);
+  pstrcpy(p2,get_local_machine_name());
   strupper_m(p2);
   p2 = skip_string(p2,1);
   p += 4;
@@ -2881,7 +2879,7 @@
     {
       fstring mypath;
       fstrcpy(mypath,"\\\\");
-      fstrcat(mypath,local_machine);
+      fstrcat(mypath,get_local_machine_name());
       strupper_m(mypath);
       PACKS(&desc,"z",mypath); /* computer */
     }

Modified: branches/SAMBA_3_0/source/smbd/msdfs.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/msdfs.c	2005-02-01 19:53:58 UTC (rev 5164)
+++ branches/SAMBA_3_0/source/smbd/msdfs.c	2005-02-01 20:43:14 UTC (rev 5165)
@@ -22,7 +22,6 @@
 
 #include "includes.h"
 
-extern fstring local_machine;
 extern uint32 global_client_caps;
 
 /**********************************************************************
@@ -462,7 +461,7 @@
 	parse_dfs_path(pathname, &dp);
 
 	/* Verify hostname in path */
-	if (local_machine && (!strequal(local_machine, dp.hostname))) {
+	if ( !strequal(get_local_machine_name(), dp.hostname) ) {
 		/* Hostname mismatch, check if one of our IP addresses */
 		if (!ismyip(*interpret_addr2(dp.hostname))) {
 			DEBUG(3, ("get_referred_path: Invalid hostname %s in path %s\n",
@@ -810,7 +809,7 @@
         parse_dfs_path(pathname,&dp);
 
         /* check if path is dfs : validate first token */
-        if (local_machine && (!strequal(local_machine,dp.hostname))) {
+        if ( !strequal(get_local_machine_name(),dp.hostname) ) {
 	    
 	   /* Hostname mismatch, check if one of our IP addresses */
 	   if (!ismyip(*interpret_addr2(dp.hostname))) {
@@ -978,7 +977,7 @@
 	}
 		
 	slprintf(ref->alternate_path, sizeof(pstring)-1,
-		 "\\\\%s\\%s", local_machine, service_name);
+		 "\\\\%s\\%s", get_local_machine_name(), service_name);
 	cnt++;
 	
 	/* Now enumerate all dfs links */

Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/trans2.c	2005-02-01 19:53:58 UTC (rev 5164)
+++ branches/SAMBA_3_0/source/smbd/trans2.c	2005-02-01 20:43:14 UTC (rev 5165)
@@ -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 @@
 			 * 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 @@
 			 * 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);



More information about the samba-cvs mailing list