1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

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)
This commit is contained in:
Samba Release Account 1997-07-18 20:21:32 +00:00
parent 8b904f4ecc
commit 612111c7a1
14 changed files with 62 additions and 33 deletions

View File

@ -4431,7 +4431,7 @@ static void usage(char *pname)
setup_logging(pname,True);
TimeInit();
charset_initialise(0);
charset_initialise();
pid = getpid();
uid = getuid();

View File

@ -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

View File

@ -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 );

View File

@ -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)

View File

@ -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();

View File

@ -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)

View File

@ -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)

View File

@ -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());

View File

@ -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

View File

@ -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)

View File

@ -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 */

View File

@ -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");

View File

@ -48,7 +48,7 @@ extern int DEBUGLEVEL;
setup_logging(argv[0],True);
charset_initialise(0);
charset_initialise();
if (argc < 2)
strcpy(configfile,CONFIGFILE);

View File

@ -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");