summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-10-24 00:09:08 +0000
committerAndrew Tridgell <tridge@samba.org>1996-10-24 00:09:08 +0000
commit08d00eb68ee93eaead0f3bbaabc3d89540e0818e (patch)
tree710ccb9b7720c18394876a415803b4a414df8b26 /source3
parent99ad4508a086205a7801e88a2f74ad6fe839431f (diff)
downloadsamba-08d00eb68ee93eaead0f3bbaabc3d89540e0818e.tar.gz
samba-08d00eb68ee93eaead0f3bbaabc3d89540e0818e.tar.bz2
samba-08d00eb68ee93eaead0f3bbaabc3d89540e0818e.zip
- added support for TMPDIR env variable
- 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)
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c4
-rw-r--r--source3/include/local.h1
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/lib/fault.c4
-rw-r--r--source3/lib/util.c17
-rw-r--r--source3/libsmb/smbencrypt.c8
-rw-r--r--source3/namedbname.c8
-rw-r--r--source3/nameservresp.c2
-rw-r--r--source3/param/loadparm.c6
-rw-r--r--source3/printing/printing.c2
-rw-r--r--source3/smbd/message.c2
-rw-r--r--source3/smbd/server.c2
12 files changed, 43 insertions, 17 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 477c8fe1f8..708b80a23b 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -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
diff --git a/source3/include/local.h b/source3/include/local.h
index 12d3fb9e88..01eac55652 100644
--- a/source3/include/local.h
+++ b/source3/include/local.h
@@ -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
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2c6047954e..803ceba688 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/lib/fault.c b/source3/lib/fault.c
index 20c75f7876..9bc2eca7e0 100644
--- a/source3/lib/fault.c
+++ b/source3/lib/fault.c
@@ -19,10 +19,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef LINUX
-#define __KERNEL__
-#endif
-
#include "includes.h"
extern int DEBUGLEVEL;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index d82dbddb44..63dda489d4 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -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
@@ -271,6 +271,21 @@ va_dcl
}
/****************************************************************************
+ 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
****************************************************************************/
BOOL is_a_socket(int fd)
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index c666e79547..7ebb99ca1a 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -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)
diff --git a/source3/namedbname.c b/source3/namedbname.c
index 0ec8cdbbbe..d2ce9b1040 100644
--- a/source3/namedbname.c
+++ b/source3/namedbname.c
@@ -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)
{
diff --git a/source3/nameservresp.c b/source3/nameservresp.c
index 7becf301d2..91f915b760 100644
--- a/source3/nameservresp.c
+++ b/source3/nameservresp.c
@@ -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
/****************************************************************************
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 34c9f27129..b65aead773 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -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. */
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 87552ab3ff..f026d77156 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -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))
{
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index 22523aad3b..2ef5b246c4 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -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);
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index c5a7a7ca02..8a6bef1525 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -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);