mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Makefile: Changed proto: target to not include c files not used currently.
Caused proto.h to be from a sorted list of C files. arcfour.h: Added prototypes. client.c: Added username%password in environment patch from John Blair <jdblair@frodo.tucc.uab.edu> loadparm.c: Added username manipulation code from Peter McCool [SMTP:peter@qimr.edu.au] username.c: Added username manipulation code from Peter McCool [SMTP:peter@qimr.edu.au] mkproto.awk: Added arc4_key type. proto.h: Updated & sorted. Jeremy (jallison@whistle.com)
This commit is contained in:
parent
eeb0e88353
commit
97ed4fea67
@ -32,4 +32,8 @@ typedef struct {
|
||||
unsigned char index_j;
|
||||
} arc4_key;
|
||||
|
||||
extern void set_arc4_key(unsigned char *data, int key_length, arc4_key *arckey);
|
||||
extern void arc4(arc4_key *arckey, unsigned char *data_in,
|
||||
unsigned char *data_out, int length);
|
||||
|
||||
#endif /* _ARC4_H_ */
|
||||
|
@ -4418,6 +4418,7 @@ static void usage(char *pname)
|
||||
extern char tar_type;
|
||||
static pstring servicesf = CONFIGFILE;
|
||||
pstring term_code;
|
||||
char *p;
|
||||
|
||||
#ifdef KANJI
|
||||
strcpy(term_code, KANJI);
|
||||
@ -4445,9 +4446,26 @@ static void usage(char *pname)
|
||||
if (getenv("USER"))
|
||||
{
|
||||
strcpy(username,getenv("USER"));
|
||||
|
||||
/* modification to support userid%passwd syntax in the USER var
|
||||
25.Aug.97, jdblair@uab.edu */
|
||||
|
||||
if ((p=strchr(username,'%')))
|
||||
{
|
||||
*p = 0;
|
||||
strcpy(password,p+1);
|
||||
got_pass = True;
|
||||
memset(strchr(getenv("USER"),'%')+1,'X',strlen(password));
|
||||
}
|
||||
strupper(username);
|
||||
}
|
||||
|
||||
/* modification to support PASSWD environmental var
|
||||
25.Aug.97, jdblair@uab.edu */
|
||||
|
||||
if (getenv("PASSWD"))
|
||||
strcpy(password,getenv("PASSWD"));
|
||||
|
||||
if (*username == 0 && getenv("LOGNAME"))
|
||||
{
|
||||
strcpy(username,getenv("LOGNAME"));
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,9 @@
|
||||
#include "includes.h"
|
||||
extern int DEBUGLEVEL;
|
||||
|
||||
/* internal functions - modified versions of the ones in password.c */
|
||||
static struct passwd *uname_string_combinations(char *s, struct passwd * (*fn) (), int N);
|
||||
static struct passwd *uname_string_combinations2(char *s, int offset, struct passwd * (*fn) (), int N);
|
||||
|
||||
/****************************************************************************
|
||||
get a users home directory. tries as-is then lower case
|
||||
@ -141,6 +144,8 @@ Note that this changes user!
|
||||
struct passwd *Get_Pwnam(char *user,BOOL allow_change)
|
||||
{
|
||||
fstring user2;
|
||||
int last_char;
|
||||
int usernamelevel = lp_usernamelevel();
|
||||
|
||||
struct passwd *ret;
|
||||
|
||||
@ -172,6 +177,19 @@ struct passwd *Get_Pwnam(char *user,BOOL allow_change)
|
||||
ret = _Get_Pwnam(user);
|
||||
if (ret) return(ret);
|
||||
|
||||
/* try with last letter capitalised */
|
||||
strlower(user);
|
||||
last_char = strlen(user)-1;
|
||||
user[last_char] = toupper(user[last_char]);
|
||||
DEBUG(3, ("Trying username %s\n", user));
|
||||
ret = _Get_Pwnam(user);
|
||||
if (ret) return(ret);
|
||||
|
||||
/* try all combinations up to usernamelevel */
|
||||
strlower(user);
|
||||
ret = uname_string_combinations(user, _Get_Pwnam, usernamelevel);
|
||||
if (ret) return(ret);
|
||||
|
||||
if (allow_change)
|
||||
strcpy(user,user2);
|
||||
|
||||
@ -250,4 +268,57 @@ BOOL user_in_list(char *user,char *list)
|
||||
return(False);
|
||||
}
|
||||
|
||||
/* The functions below have been taken from password.c and slightly modified */
|
||||
/****************************************************************************
|
||||
apply a function to upper/lower case combinations
|
||||
of a string and return true if one of them returns true.
|
||||
try all combinations with N uppercase letters.
|
||||
offset is the first char to try and change (start with 0)
|
||||
it assumes the string starts lowercased
|
||||
****************************************************************************/
|
||||
static struct passwd *uname_string_combinations2(char *s,int offset,struct passwd *(*fn)(),int N)
|
||||
{
|
||||
int len = strlen(s);
|
||||
int i;
|
||||
struct passwd *ret;
|
||||
|
||||
#ifdef PASSWORD_LENGTH
|
||||
len = MIN(len,PASSWORD_LENGTH);
|
||||
#endif
|
||||
|
||||
if (N <= 0 || offset >= len)
|
||||
return(fn(s));
|
||||
|
||||
|
||||
for (i=offset;i<(len-(N-1));i++)
|
||||
|
||||
{
|
||||
char c = s[i];
|
||||
if (!islower(c)) continue;
|
||||
s[i] = toupper(c);
|
||||
ret = uname_string_combinations2(s,i+1,fn,N-1);
|
||||
if(ret) return(ret);
|
||||
s[i] = c;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
apply a function to upper/lower case combinations
|
||||
of a string and return true if one of them returns true.
|
||||
try all combinations with up to N uppercase letters.
|
||||
offset is the first char to try and change (start with 0)
|
||||
it assumes the string starts lowercased
|
||||
****************************************************************************/
|
||||
static struct passwd * uname_string_combinations(char *s,struct passwd * (*fn)(),int N)
|
||||
{
|
||||
int n;
|
||||
struct passwd *ret;
|
||||
|
||||
for (n=1;n<=N;n++)
|
||||
{
|
||||
ret = uname_string_combinations2(s,0,fn,n);
|
||||
if(ret) return(ret);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
@ -146,6 +146,7 @@ typedef struct
|
||||
int max_mux;
|
||||
int max_packet;
|
||||
int pwordlevel;
|
||||
int unamelevel;
|
||||
int deadtime;
|
||||
int maxprotocol;
|
||||
int security;
|
||||
@ -449,6 +450,7 @@ struct parm_struct
|
||||
{"max packet", P_INTEGER, P_GLOBAL, &Globals.max_packet, NULL},
|
||||
{"packet size", P_INTEGER, P_GLOBAL, &Globals.max_packet, NULL},
|
||||
{"password level", P_INTEGER, P_GLOBAL, &Globals.pwordlevel, NULL},
|
||||
{"username level", P_INTEGER, P_GLOBAL, &Globals.unamelevel, NULL},
|
||||
{"keepalive", P_INTEGER, P_GLOBAL, &keepalive, NULL},
|
||||
{"deadtime", P_INTEGER, P_GLOBAL, &Globals.deadtime, NULL},
|
||||
{"time offset", P_INTEGER, P_GLOBAL, &extra_time_offset, NULL},
|
||||
@ -619,6 +621,7 @@ static void init_globals(void)
|
||||
Globals.max_mux = 50; /* This is *needed* for profile support. */
|
||||
Globals.lpqcachetime = 10;
|
||||
Globals.pwordlevel = 0;
|
||||
Globals.unamelevel = 0;
|
||||
Globals.deadtime = 0;
|
||||
Globals.max_log_size = 5000;
|
||||
Globals.maxprotocol = PROTOCOL_NT1;
|
||||
@ -865,6 +868,7 @@ FN_GLOBAL_INTEGER(lp_maxmux,&Globals.max_mux)
|
||||
FN_GLOBAL_INTEGER(lp_maxpacket,&Globals.max_packet)
|
||||
FN_GLOBAL_INTEGER(lp_keepalive,&keepalive)
|
||||
FN_GLOBAL_INTEGER(lp_passwordlevel,&Globals.pwordlevel)
|
||||
FN_GLOBAL_INTEGER(lp_usernamelevel,&Globals.unamelevel)
|
||||
FN_GLOBAL_INTEGER(lp_readsize,&Globals.ReadSize)
|
||||
FN_GLOBAL_INTEGER(lp_shmem_size,&Globals.shmem_size)
|
||||
FN_GLOBAL_INTEGER(lp_shmem_hash_size,&Globals.shmem_hash_size)
|
||||
|
@ -64,7 +64,7 @@ BEGIN {
|
||||
next;
|
||||
}
|
||||
|
||||
!/^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^enum remote_arch_types/ {
|
||||
!/^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^enum remote_arch_types|arc4_key/ {
|
||||
next;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user