summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-07-18 20:21:32 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-07-18 20:21:32 +0000
commit612111c7a1a048d19e24b5e2e4d426247d320d1e (patch)
tree1a24304f1f3b3a171fbe6deab8711d63f3a6b965
parent8b904f4ecc7b6bd6558d40fda4184112bbb10366 (diff)
downloadsamba-612111c7a1a048d19e24b5e2e4d426247d320d1e.tar.gz
samba-612111c7a1a048d19e24b5e2e4d426247d320d1e.tar.bz2
samba-612111c7a1a048d19e24b5e2e4d426247d320d1e.zip
charset.c: Split charset_initialise() into 2 - a charset_initialise() and
a codepage_initialise(). Fixes problem with initialising dos map twice. charset.h: Changes to support charset changes. client.c: Changes to support charset changes. loadparm.c: follow symlinks parameter from David Clerc <David.Clerc@cui.unige.ch> nmbd.c: Changes to support charset changes. nmblookup.c:Changes to support charset changes. proto.h: Changes to support charset changes. reply.c: Don't call security=server with no user/no password guest. Fix from Stefaan A Eeckels <Stefaan.Eeckels@ecc.lu> server.c: follow symlinks code from David Clerc <David.Clerc@cui.unige.ch> smbpasswd.c:Changes to support charset changes. status.c: Changes to support charset changes. testparm.c: Changes to support charset changes. testprns.c: Changes to support charset changes. uid.c: Fixed log message with no \n. Jeremy (jallison@whistle.com) (This used to be commit 2a28a6e5e461aca7fe6c19cd01d287010056cffb)
-rw-r--r--source3/client/client.c2
-rw-r--r--source3/include/charset.h2
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/lib/charset.c27
-rw-r--r--source3/nmbd/nmbd.c4
-rw-r--r--source3/param/loadparm.c4
-rw-r--r--source3/smbd/reply.c20
-rw-r--r--source3/smbd/server.c20
-rw-r--r--source3/smbd/uid.c2
-rw-r--r--source3/utils/nmblookup.c2
-rw-r--r--source3/utils/smbpasswd.c2
-rw-r--r--source3/utils/status.c2
-rw-r--r--source3/utils/testparm.c2
-rw-r--r--source3/utils/testprns.c2
14 files changed, 62 insertions, 33 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index c7e00c4515..dd739fdfa5 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4431,7 +4431,7 @@ static void usage(char *pname)
setup_logging(pname,True);
TimeInit();
- charset_initialise(0);
+ charset_initialise();
pid = getpid();
uid = getuid();
diff --git a/source3/include/charset.h b/source3/include/charset.h
index 25544fb621..5f5e2016ee 100644
--- a/source3/include/charset.h
+++ b/source3/include/charset.h
@@ -25,7 +25,7 @@ extern char *dos_char_map;
extern char *upper_char_map;
extern char *lower_char_map;
extern void add_char_string(char *s);
-extern void charset_initialise(int);
+extern void charset_initialise(void);
#ifdef toupper
#undef toupper
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 5ba308561f..e9994214fb 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -14,7 +14,8 @@ int interpret_character_set(char *str, int def);
/*The following definitions come from charset.c */
-void charset_initialise(int client_codepage);
+void charset_initialise(void);
+void codepage_initialise(int client_codepage);
void add_char_string(char *s);
/*The following definitions come from chgpasswd.c */
@@ -243,6 +244,7 @@ BOOL lp_share_modes(int );
BOOL lp_onlyuser(int );
BOOL lp_manglednames(int );
BOOL lp_widelinks(int );
+BOOL lp_symlinks(int );
BOOL lp_syncalways(int );
BOOL lp_map_system(int );
BOOL lp_delete_readonly(int );
diff --git a/source3/lib/charset.c b/source3/lib/charset.c
index f066b9a472..b463344daa 100644
--- a/source3/lib/charset.c
+++ b/source3/lib/charset.c
@@ -198,10 +198,9 @@ static void add_dos_char(int lower, BOOL map_lower_to_upper,
/****************************************************************************
initialise the charset arrays
****************************************************************************/
-void charset_initialise(int client_codepage)
+void charset_initialise()
{
int i;
- unsigned char (*cp)[4];
#ifdef LC_ALL
/* include <locale.h> in includes.h if available for OS */
@@ -215,7 +214,7 @@ void charset_initialise(int client_codepage)
for (i=0;i<=127;i++) {
if (isalnum((char)i) || strchr("._^$~!#%&-{}()@'`",(char)i))
- add_dos_char(i,0,False,False);
+ add_dos_char(i,False,0,False);
}
for (i=0; i<=255; i++) {
@@ -224,9 +223,17 @@ void charset_initialise(int client_codepage)
if (isupper(c)) lower_char_map[i] = tolower(c);
if (islower(c)) upper_char_map[i] = toupper(c);
}
+}
- if(client_codepage != -1)
- DEBUG(6,("charset_initialise: client code page = %d\n", client_codepage));
+/****************************************************************************
+initialise the client codepage.
+****************************************************************************/
+void codepage_initialise(int client_codepage)
+{
+ int i;
+ unsigned char (*cp)[4] = NULL;
+
+ DEBUG(6,("codepage_initialise: client code page = %d\n", client_codepage));
/*
* Known client codepages - these can be added to.
@@ -239,16 +246,12 @@ void charset_initialise(int client_codepage)
case 437:
cp = cp_437;
break;
- case -1: /* pre-initialize call so that toupper/tolower work
- before smb.conf is read. */
- cp = NULL;
- break;
default:
- /* Default charset - currently 850 */
- DEBUG(6,("charset_initialise: Using default client codepage %d\n", 850));
+ /* Use default codepage - currently 850 */
+ DEBUG(6,("codepage_initialise: Using default client codepage %d\n",
+ 850));
cp = cp_850;
break;
-
}
if(cp)
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index bf29829317..14611dc2c5 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -421,7 +421,7 @@ static void usage(char *pname)
setup_logging(argv[0],False);
- charset_initialise(-1);
+ charset_initialise();
#ifdef LMHOSTSFILE
strcpy(host_file,LMHOSTSFILE);
@@ -498,7 +498,7 @@ static void usage(char *pname)
if (!reload_services(False))
return(-1);
- charset_initialise(lp_client_code_page());
+ codepage_initialise(lp_client_code_page());
init_structs();
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index af6c4657bf..89595caa0d 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -253,6 +253,7 @@ typedef struct
BOOL bOnlyUser;
BOOL bMangledNames;
BOOL bWidelinks;
+ BOOL bSymlinks;
BOOL bSyncAlways;
char magic_char;
BOOL *copymap;
@@ -332,6 +333,7 @@ static service sDefault =
False, /* bOnlyUser */
True, /* bMangledNames */
True, /* bWidelinks */
+ True, /* bSymlinks */
False, /* bSyncAlways */
'~', /* magic char */
NULL, /* copymap */
@@ -528,6 +530,7 @@ struct parm_struct
{"share modes", P_BOOL, P_LOCAL, &sDefault.bShareModes, NULL},
{"only user", P_BOOL, P_LOCAL, &sDefault.bOnlyUser, NULL},
{"wide links", P_BOOL, P_LOCAL, &sDefault.bWidelinks, NULL},
+ {"follow symlinks", P_BOOL, P_LOCAL, &sDefault.bSymlinks, NULL},
{"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL},
{"mangled names", P_BOOL, P_LOCAL, &sDefault.bMangledNames, NULL},
{"fake oplocks", P_BOOL, P_LOCAL, &sDefault.bFakeOplocks, NULL},
@@ -920,6 +923,7 @@ FN_LOCAL_BOOL(lp_share_modes,bShareModes)
FN_LOCAL_BOOL(lp_onlyuser,bOnlyUser)
FN_LOCAL_BOOL(lp_manglednames,bMangledNames)
FN_LOCAL_BOOL(lp_widelinks,bWidelinks)
+FN_LOCAL_BOOL(lp_symlinks,bSymlinks)
FN_LOCAL_BOOL(lp_syncalways,bSyncAlways)
FN_LOCAL_BOOL(lp_map_system,bMap_system)
FN_LOCAL_BOOL(lp_delete_readonly,bDeleteReadonly)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 315c7fbb51..5869588664 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -409,8 +409,14 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
}
+ /* If no username is sent use the guest account */
if (!*user)
- strcpy(user,lp_guestaccount(-1));
+ {
+ strcpy(user,lp_guestaccount(-1));
+ /* If no user and no password then set guest flag. */
+ if( *smb_apasswd == 0)
+ guest = True;
+ }
strlower(user);
@@ -421,24 +427,22 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
add_session_user(user);
- if (!(lp_security() == SEC_SERVER && server_validate(inbuf)) &&
+ if (!guest && !(lp_security() == SEC_SERVER && server_validate(inbuf)) &&
!check_hosts_equiv(user))
{
- if (strequal(user,lp_guestaccount(-1)) && (*smb_apasswd == 0))
- guest = True;
-
/* now check if it's a valid username/password */
/* If an NT password was supplied try and validate with that
- first. This is superior as the passwords are mixed case 128 length unicode */
- if(smb_ntpasslen && !guest)
+ first. This is superior as the passwords are mixed case
+ 128 length unicode */
+ if(smb_ntpasslen)
{
if(!password_ok(user,smb_ntpasswd,smb_ntpasslen,NULL))
DEBUG(0,("NT Password did not match ! Defaulting to Lanman\n"));
else
valid_nt_password = True;
}
- if (!valid_nt_password && !guest && !password_ok(user,smb_apasswd,smb_apasslen,NULL))
+ if (!valid_nt_password && !password_ok(user,smb_apasswd,smb_apasslen,NULL))
{
if (!computer_id && lp_security() >= SEC_USER) {
#if (GUEST_SESSSETUP == 0)
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 2969624215..5f5404bcc2 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -817,6 +817,22 @@ BOOL check_name(char *name,int cnum)
}
ret = reduce_name(name,Connections[cnum].connectpath,lp_widelinks(SNUM(cnum)));
+
+ /* Check if we are allowing users to follow symlinks */
+ /* Patch from David Clerc <David.Clerc@cui.unige.ch>
+ University of Geneva */
+
+ if (!lp_symlinks(SNUM(cnum)))
+ {
+ struct stat statbuf;
+ if ( (sys_lstat(name,&statbuf) != -1) &&
+ (S_ISLNK(statbuf.st_mode)) )
+ {
+ DEBUG(3,("check_name: denied: file path name %s is a symlink\n",name));
+ ret=0;
+ }
+ }
+
if (!ret)
DEBUG(5,("check_name on %s failed\n",name));
@@ -4111,7 +4127,7 @@ static void usage(char *pname)
setup_logging(argv[0],False);
- charset_initialise(-1);
+ charset_initialise();
/* make absolutely sure we run as root - to handle cases whre people
are crazy enough to have it setuid */
@@ -4226,7 +4242,7 @@ static void usage(char *pname)
if (!reload_services(False))
return(-1);
- charset_initialise(lp_client_code_page());
+ codepage_initialise(lp_client_code_page());
strcpy(myworkgroup, lp_workgroup());
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 0cf1c217a9..cdc4e474c6 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -83,7 +83,7 @@ static BOOL become_uid(int uid)
&priv, sizeof(priv_t)) < 0 ||
setuidx(ID_REAL|ID_EFFECTIVE, (uid_t)uid) < 0 ||
seteuid((uid_t)uid) < 0)
- DEBUG(1,("Can't set uid (AIX3)"));
+ DEBUG(1,("Can't set uid (AIX3)\n"));
}
#endif
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 68093c10ed..582f4eb6db 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -111,7 +111,7 @@ int main(int argc,char *argv[])
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
while ((opt = getopt(argc, argv, "p:d:B:i:s:SMh")) != EOF)
switch (opt)
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 6867ff3b8a..e03ebbaaef 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -236,7 +236,7 @@ static void usage(char *name)
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
#ifndef DEBUG_PASSWORD
/* Check the effective uid */
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 77fbc7fae1..b439741e6c 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -155,7 +155,7 @@ locking version (was %d, should be %d).\n",fname,
TimeInit();
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
DEBUGLEVEL = 0;
dbf = fopen("/dev/null","w");
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index e9a848eb0b..81e69cd76f 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -48,7 +48,7 @@ extern int DEBUGLEVEL;
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
if (argc < 2)
strcpy(configfile,CONFIGFILE);
diff --git a/source3/utils/testprns.c b/source3/utils/testprns.c
index c96ad476d2..4a2ddb7c63 100644
--- a/source3/utils/testprns.c
+++ b/source3/utils/testprns.c
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
if (argc < 2 || argc > 3)
printf("Usage: testprns printername [printcapfile]\n");