loadparm.c: Cause IPC$ comment to be evaluated at runtime, rather than
authorJeremy Allison <jra@samba.org>
Mon, 6 Apr 1998 18:14:56 +0000 (18:14 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 6 Apr 1998 18:14:56 +0000 (18:14 +0000)
load time (patch from "Marty Leisner" <leisner@sdsp.mc.xerox.com>.
server.c: Patch from Josef Hinteregger <joehtg@joehtg.co.at> - string
could be overwritten when find_service() called recursively.
Jeremy.

source/param/loadparm.c
source/smbd/server.c

index 20479bf96d46d01624be2c56ae89edd1da63abbb..837632788e8cdc62fe4dac9d3451fe6d0bfc2194 100644 (file)
@@ -1232,7 +1232,7 @@ static BOOL lp_add_ipc(void)
   if (i < 0)
     return(False);
 
-  sprintf(comment,"IPC Service (%s)",lp_serverstring());
+  sprintf(comment,"IPC Service (%s)", Globals.szServerString );
 
   string_set(&iSERVICE(i).szPath,tmpdir());
   string_set(&iSERVICE(i).szUsername,"");
index 8166021fc2dce6762f0e69f49a3be76f4425fa79..d0b0304430c37fc25f371c61eec00295bdc2bf82 100644 (file)
@@ -2214,8 +2214,16 @@ int find_service(char *service)
    /* just possibly it's a default service? */
    if (iService < 0) 
      {
-       char *defservice = lp_defaultservice();
-       if (defservice && *defservice && !strequal(defservice,service)) {
+       char *pdefservice = lp_defaultservice();
+       if (pdefservice && *pdefservice && !strequal(pdefservice,service)) {
+         /*
+          * We need to do a local copy here as lp_defaultservice() 
+          * returns one of the rotating lp_string buffers that
+          * could get overwritten by the recursive find_service() call
+          * below. Fix from Josef Hinteregger <joehtg@joehtg.co.at>.
+          */
+         pstring defservice;
+         pstrcpy(defservice, pdefservice);
         iService = find_service(defservice);
         if (iService >= 0) {
           string_sub(service,"_","/");