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)
setup_logging(pname,True);
TimeInit();
- charset_initialise(0);
+ charset_initialise();
pid = getpid();
uid = getuid();
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
/*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 */
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 );
/****************************************************************************
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 */
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++) {
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.
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)
setup_logging(argv[0],False);
- charset_initialise(-1);
+ charset_initialise();
#ifdef LMHOSTSFILE
strcpy(host_file,LMHOSTSFILE);
if (!reload_services(False))
return(-1);
- charset_initialise(lp_client_code_page());
+ codepage_initialise(lp_client_code_page());
init_structs();
BOOL bOnlyUser;
BOOL bMangledNames;
BOOL bWidelinks;
+ BOOL bSymlinks;
BOOL bSyncAlways;
char magic_char;
BOOL *copymap;
False, /* bOnlyUser */
True, /* bMangledNames */
True, /* bWidelinks */
+ True, /* bSymlinks */
False, /* bSyncAlways */
'~', /* magic char */
NULL, /* copymap */
{"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},
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)
}
+ /* 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);
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)
}
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));
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 */
if (!reload_services(False))
return(-1);
- charset_initialise(lp_client_code_page());
+ codepage_initialise(lp_client_code_page());
strcpy(myworkgroup, lp_workgroup());
&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
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
while ((opt = getopt(argc, argv, "p:d:B:i:s:SMh")) != EOF)
switch (opt)
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
#ifndef DEBUG_PASSWORD
/* Check the effective uid */
TimeInit();
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
DEBUGLEVEL = 0;
dbf = fopen("/dev/null","w");
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
if (argc < 2)
strcpy(configfile,CONFIGFILE);
setup_logging(argv[0],True);
- charset_initialise(0);
+ charset_initialise();
if (argc < 2 || argc > 3)
printf("Usage: testprns printername [printcapfile]\n");