- added support for TMPDIR env variable
authorAndrew Tridgell <tridge@samba.org>
Thu, 24 Oct 1996 00:09:08 +0000 (00:09 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 24 Oct 1996 00:09:08 +0000 (00:09 +0000)
- fixed fault.c for linux 2.1
- put back in the FIND_SELF failing code
- cleaned up casts in encryption
(This used to be commit 3af04f1580b2569c0a4f2549bf6352c7a25afa0d)

12 files changed:
source3/client/client.c
source3/include/local.h
source3/include/proto.h
source3/lib/fault.c
source3/lib/util.c
source3/libsmb/smbencrypt.c
source3/namedbname.c
source3/nameservresp.c
source3/param/loadparm.c
source3/printing/printing.c
source3/smbd/message.c
source3/smbd/server.c

index 477c8fe1f8bf767eaf48091e2219e97a34873f2e..708b80a23b83cf4163b2123d319c43ee5d11585d 100644 (file)
@@ -1651,7 +1651,7 @@ static void cmd_more(void)
 
   strcpy(rname,cur_dir);
   strcat(rname,"\\");
-  sprintf(tmpname,"/tmp/smbmore.%d",getpid());
+  sprintf(tmpname,"%s/smbmore.%d",tmpdir(),getpid());
   strcpy(lname,tmpname);
 
   if (!next_token(NULL,rname+strlen(rname),NULL)) {
@@ -2125,7 +2125,7 @@ static void cmd_mput(void)
       pstring tmpname;
       FILE *f;
       
-      sprintf(tmpname,"/tmp/ls.smb.%d",(int)getpid());
+      sprintf(tmpname,"%s/ls.smb.%d",tmpdir(),(int)getpid());
       if (recurse)
        sprintf(cmd,"find . -name \"%s\" -print > %s",p,tmpname);
       else
index 12d3fb9e88bd21f9cf7e17d36a2bd8881f08983e..01eac556525e38da1edf1663ff2edb975b3ea509 100644 (file)
@@ -47,6 +47,7 @@
 #define LIST_SEP " \t,;:\n\r"
 
 #ifndef LOCKDIR
+/* this should have been set in the Makefile */
 #define LOCKDIR "/tmp/samba"
 #endif
 
index 2c6047954ec55001d3d4032302601412b2a67ce0..803ceba6886347c864b1f502a80057f29b9fc478 100644 (file)
@@ -739,6 +739,9 @@ struct smb_passwd *get_smbpwnam(char *name);
 /*The following definitions come from  smbrun.c  */
 
 
+/*The following definitions come from  smbwizard.c  */
+
+
 /*The following definitions come from  status.c  */
 
 void Ucrit_addUsername(pstring username);
@@ -819,6 +822,7 @@ BOOL user_in_list(char *user,char *list);
 
 void setup_logging(char *pname,BOOL interactive);
 void reopen_logs(void);
+char *tmpdir(void);
 BOOL is_a_socket(int fd);
 BOOL next_token(char **ptr,char *buff,char *sep);
 char **toktocliplist(int *ctok, char *sep);
index 20c75f7876c18e15add401c676f2a956c83cf649..9bc2eca7e02d6f6bf044071310087babddacef44 100644 (file)
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#ifdef LINUX
-#define __KERNEL__
-#endif
-
 #include "includes.h"
 extern int DEBUGLEVEL;
 
index d82dbddb4460e4d6c04eb1f680342bb085ba4f26..63dda489d4b4aedd162866fceb895924beb81674 100644 (file)
@@ -54,7 +54,7 @@ int trans_num = 0;
 */
 int case_default = CASE_LOWER;
 
-pstring debugf = "/tmp/log.samba";
+pstring debugf = "";
 int syslog_level;
 
 /* the following control case operations - they are put here so the
@@ -270,6 +270,21 @@ va_dcl
   return(0);
 }
 
+/****************************************************************************
+  find a suitable temporary directory. The result should be copied immediately
+  as it may be overwritten by a subsequent call
+  ****************************************************************************/
+char *tmpdir(void)
+{
+  char *p;
+  if ((p = getenv("TMPDIR"))) {
+    return p;
+  }
+  return "/tmp";
+}
+
+
+
 /****************************************************************************
 determine if a file descriptor is in fact a socket
 ****************************************************************************/
index c666e79547d948776f26f29ce10bc45dab1ce95a..7ebb99ca1a8ada4ecc7cec31b2dd7225f81b27c9 100644 (file)
@@ -54,8 +54,8 @@ void D1(uchar *k, uchar *d, uchar *out)
   des_cblock deskey;
 
   str_to_key(k,(uchar *)deskey);
-  des_set_key(deskey,ks);
-  des_ecb_encrypt(d, out, ks, DES_DECRYPT);
+  des_set_key((des_cblock *)deskey,ks);
+  des_ecb_encrypt((des_cblock *)d,(des_cblock *)out, ks, DES_DECRYPT);
 }
 
 void E1(uchar *k, uchar *d, uchar *out)
@@ -64,8 +64,8 @@ void E1(uchar *k, uchar *d, uchar *out)
   des_cblock deskey;
 
   str_to_key(k,(uchar *)deskey);
-  des_set_key(deskey,ks);
-  des_ecb_encrypt(d, out, ks, DES_ENCRYPT);
+  des_set_key((des_cblock *)deskey,ks);
+  des_ecb_encrypt((des_cblock *)d,(des_cblock *)out, ks, DES_ENCRYPT);
 }
  
 void E_P16(uchar *p14,uchar *p16)
index 0ec8cdbbbe581a2a20c504c4406f5c8faeeb2c7a..d2ce9b104044c1aaa6a1827eb04aa391260b3440 100644 (file)
@@ -529,6 +529,14 @@ struct name_record *search_for_name(struct subnet_record **d,
   
   if (*d == NULL) return NULL;
 
+  if (!n && (search & FIND_SELF)) {
+    if (!lp_wins_proxy())
+      DEBUG(3,("wins proxy not enabled - failing lookup\n"));
+    else
+      DEBUG(3,("FIND_SELF set - failing lookup\n"));
+    return NULL;
+  }
+
   /* now try DNS lookup. */
   if (!n)
     {
index 7becf301d2b9c4e36e20e7b8645c3dba6622d96b..91f915b760f6d90a34145623ac780c934d9e9064 100644 (file)
@@ -614,6 +614,7 @@ static BOOL response_problem_check(struct response_record *n,
   return False;
 }
 
+#if 0
 /****************************************************************************
   check that the response received is compatible with the response record
   ****************************************************************************/
@@ -679,6 +680,7 @@ static BOOL response_compatible(struct response_record *n,
   }
   return True;
 }
+#endif
 
 
 /****************************************************************************
index 34c9f27129aa83ef3c372f8297cc7588bda28590..b65aead773959841abe0d1566fd06b54bea0e3a2 100644 (file)
@@ -994,7 +994,7 @@ static BOOL lp_add_ipc(void)
 
   sprintf(comment,"IPC Service (%s)",lp_serverstring());
 
-  string_set(&iSERVICE(i).szPath,"/tmp");
+  string_set(&iSERVICE(i).szPath,tmpdir());
   string_set(&iSERVICE(i).szUsername,"");
   string_set(&iSERVICE(i).comment,comment);
   iSERVICE(i).status = False;
@@ -1228,8 +1228,8 @@ static BOOL service_ok(int iService)
    if (iSERVICE(iService).szPath[0] == '\0' &&
        strwicmp(iSERVICE(iService).szService,HOMES_NAME) != 0)
    {
-      DEBUG(0,("No path in service %s - using /tmp\n",iSERVICE(iService).szService));
-      string_set(&iSERVICE(iService).szPath,"/tmp");      
+      DEBUG(0,("No path in service %s - using %s\n",iSERVICE(iService).szService,tmpdir()));
+      string_set(&iSERVICE(iService).szPath,tmpdir());      
    }
 
    /* If a service is flagged unavailable, log the fact at level 0. */
index 87552ab3ffd83f307a57979360567ef5a3474bf2..f026d77156eae53e9ab78eace675bcee3c3eb94b 100644 (file)
@@ -945,7 +945,7 @@ int get_printqueue(int snum,int cnum,print_queue_struct **queue,
 
   standard_sub(cnum,syscmd);
 
-  sprintf(outfile,"/tmp/lpq.%08x",str_checksum(syscmd));
+  sprintf(outfile,"%s/lpq.%08x",tmpdir(),str_checksum(syscmd));
   
   if (!lpq_cache_reset[snum] && cachetime && !stat(outfile,&sbuf)) 
     {
index 22523aad3b1585e9914f163f8c2487c15b55ce83..2ef5b246c44862838133a4b2f2d335203b31c38c 100644 (file)
@@ -53,7 +53,7 @@ static void msg_deliver(void)
     }
 
   /* put it in a temporary file */
-  sprintf(s,"/tmp/msg.XXXXXX");
+  sprintf(s,"%s/msg.XXXXXX",tmpdir());
   strcpy(name,(char *)mktemp(s));
 
   fd = open(name,O_WRONLY|O_CREAT|O_TRUNC|O_EXCL,0600);
index c5a7a7ca02b9b67df7fb83d64e726245578de490..8a6bef1525b5821a037b675d09193b526ae752a4 100644 (file)
@@ -564,7 +564,7 @@ int disk_free(char *path,int *bsize,int *dfree,int *dsize)
       pstring syscmd;
       pstring outfile;
          
-      sprintf(outfile,"/tmp/dfree.smb.%d",(int)getpid());
+      sprintf(outfile,"%s/dfree.smb.%d",tmpdir(),(int)getpid());
       sprintf(syscmd,"%s %s",df_command,path);
       standard_sub_basic(syscmd);