diff options
author | cvs2svn Import User <samba-bugs@samba.org> | 1997-10-15 01:38:14 +0000 |
---|---|---|
committer | cvs2svn Import User <samba-bugs@samba.org> | 1997-10-15 01:38:14 +0000 |
commit | dc1f10efa87576a0289fa71aaeed015a3675b029 (patch) | |
tree | fca7a02192adb888fe6b4d239c5d1fa32d0a08ca /source/lib/username.c | |
parent | 332f78bbc945c327069e9c9e29c7137c8cbd5c02 (diff) | |
parent | a173a1495c50b5ad1f6b47710cf4b4a7a2226b46 (diff) | |
download | samba-2513cedae3c49605a7d8301188ec2e289e840882.tar.gz |
This commit was manufactured by cvs2svn to create tagsamba-1.9.17p3
'release-1-9-17p3'.
Diffstat (limited to 'source/lib/username.c')
-rw-r--r-- | source/lib/username.c | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/source/lib/username.c b/source/lib/username.c index a9f64259916..46b8f4cb332 100644 --- a/source/lib/username.c +++ b/source/lib/username.c @@ -22,9 +22,6 @@ #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 @@ -144,8 +141,6 @@ 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; @@ -177,19 +172,6 @@ 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) fstrcpy(user,user2); @@ -268,57 +250,4 @@ 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); -} |