diff options
author | Luke Leighton <lkcl@samba.org> | 1998-05-07 18:19:05 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-05-07 18:19:05 +0000 |
commit | d8d9f7723337c267a8740750fe19a6387cfbb1f6 (patch) | |
tree | 224590bcd9c5d6d60c5a519741c0662834ba4a1d /source3/passdb/smbpass.c | |
parent | 51f88b4f7c0b87dd4a8932168c512b29a4915045 (diff) | |
download | samba-d8d9f7723337c267a8740750fe19a6387cfbb1f6.tar.gz samba-d8d9f7723337c267a8740750fe19a6387cfbb1f6.tar.bz2 samba-d8d9f7723337c267a8740750fe19a6387cfbb1f6.zip |
created "passdb.c" which is an interface point to (at present) either
smbpasswd or ldap passwd, at compile-time (-DUSE_LDAP).
_none_ of the functions in ldap.c or smbpass.c should be called directly:
only those in passdb.c should be used.
-DUSE_LDAP is unlikely to compile at the moment.
(This used to be commit 57b01ad4ffb14ebd600d4e66602b54ed987f6106)
Diffstat (limited to 'source3/passdb/smbpass.c')
-rw-r--r-- | source3/passdb/smbpass.c | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/source3/passdb/smbpass.c b/source3/passdb/smbpass.c index 56eade7cd3..defadadf69 100644 --- a/source3/passdb/smbpass.c +++ b/source3/passdb/smbpass.c @@ -17,6 +17,17 @@ * Mass Ave, Cambridge, MA 02139, USA. */ +/*X*X*X*X*X*X*X**X*X*X*X*X*X*X**X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X* + *X*X*X*X*X*X*X**X*X*X*X*X*X*X**X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X* + *X*X*X*X*X*X*X**X*X*X*X*X*X*X**X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X* + + DO NOT CALL ANY OF THE ROUTINES IN THIS MODULE DIRECTLY. + USE passdb.c INSTEAD. + + *X*X*X*X*X*X*X**X*X*X*X*X*X*X**X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X* + *X*X*X*X*X*X*X**X*X*X*X*X*X*X**X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X* + *X*X*X*X*X*X*X**X*X*X*X*X*X*X**X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*/ + #include "includes.h" extern int DEBUGLEVEL; @@ -112,7 +123,10 @@ static BOOL pw_file_unlock(int fd, int *plock_depth) /*************************************************************** Start to enumerate the smbpasswd list. Returns a void pointer to ensure no modification outside this module. -****************************************************************/ + + do not call this function directly. use passdb.c instead. + + ****************************************************************/ void *startsmbpwent(BOOL update) { @@ -192,6 +206,9 @@ static int gethexpwd(char *p, char *pwd) /************************************************************************* Routine to return the next entry in the smbpasswd list. + + do not call this function directly. use passdb.c instead. + *************************************************************************/ struct smb_passwd *getsmbpwent(void *vp) @@ -482,8 +499,10 @@ struct smb_passwd *getsmbpwent(void *vp) /************************************************************************* Return the current position in the smbpasswd list as an unsigned long. This must be treated as an opaque token. -*************************************************************************/ + do not call this function directly. use passdb.c instead. + +*************************************************************************/ unsigned long getsmbpwpos(void *vp) { return (unsigned long)ftell((FILE *)vp); @@ -492,8 +511,10 @@ unsigned long getsmbpwpos(void *vp) /************************************************************************* Set the current position in the smbpasswd list from unsigned long. This must be treated as an opaque token. -*************************************************************************/ + do not call this function directly. use passdb.c instead. + +*************************************************************************/ BOOL setsmbpwpos(void *vp, unsigned long tok) { return !fseek((FILE *)vp, tok, SEEK_SET); @@ -503,7 +524,6 @@ BOOL setsmbpwpos(void *vp, unsigned long tok) Routine to search the smbpasswd file for an entry matching the username or user id. if the name is NULL, then the smb_uid is used instead. *************************************************************************/ - static struct smb_passwd *get_smbpwd_entry(char *name, int smb_userid) { struct smb_passwd *pwd = NULL; @@ -549,31 +569,25 @@ static struct smb_passwd *get_smbpwd_entry(char *name, int smb_userid) } /************************************************************************ - Routine to search smbpasswd by name. + Routine to search smb passwd by name. *************************************************************************/ struct smb_passwd *getsmbpwnam(char *name) { -#ifdef USE_LDAP - return ldap_get_smbpwd_entry(name, 0); -#else /* USE_LDAP */ return get_smbpwd_entry(name, 0); -#endif /* USE_LDAP */ } + /************************************************************************ - Routine to search smbpasswd by uid. + Routine to search smb passwd by uid. *************************************************************************/ struct smb_passwd *getsmbpwuid(unsigned int uid) { -#ifdef USE_LDAP - return ldap_get_smbpwd_entry(NULL, uid); -#else /* USE_DLAP */ return get_smbpwd_entry(NULL, uid); -#endif /* USE_LDAP */ } + /********************************************************** Encode the account control bits into a string. **********************************************************/ @@ -585,24 +599,15 @@ char *encode_acct_ctrl(uint16 acct_ctrl) *p++ = '['; - if(acct_ctrl & ACB_HOMDIRREQ) - *p++ = 'H'; - if(acct_ctrl & ACB_TEMPDUP) - *p++ = 'T'; - if(acct_ctrl & ACB_NORMAL) - *p++ = 'U'; - if(acct_ctrl & ACB_MNS) - *p++ = 'M'; - if(acct_ctrl & ACB_WSTRUST) - *p++ = 'W'; - if(acct_ctrl & ACB_SVRTRUST) - *p++ = 'S'; - if(acct_ctrl & ACB_AUTOLOCK) - *p++ = 'L'; - if(acct_ctrl & ACB_PWNOEXP) - *p++ = 'X'; - if(acct_ctrl & ACB_DOMTRUST) - *p++ = 'I'; + if (acct_ctrl & ACB_HOMDIRREQ) *p++ = 'H'; + if (acct_ctrl & ACB_TEMPDUP ) *p++ = 'T'; + if (acct_ctrl & ACB_NORMAL ) *p++ = 'U'; + if (acct_ctrl & ACB_MNS ) *p++ = 'M'; + if (acct_ctrl & ACB_WSTRUST ) *p++ = 'W'; + if (acct_ctrl & ACB_SVRTRUST ) *p++ = 'S'; + if (acct_ctrl & ACB_AUTOLOCK ) *p++ = 'L'; + if (acct_ctrl & ACB_PWNOEXP ) *p++ = 'X'; + if (acct_ctrl & ACB_DOMTRUST ) *p++ = 'I'; *p++ = ']'; *p = '\0'; @@ -611,6 +616,9 @@ char *encode_acct_ctrl(uint16 acct_ctrl) /************************************************************************ Routine to add an entry to the smbpasswd file. + + do not call this function directly. use passdb.c instead. + *************************************************************************/ BOOL add_smbpwd_entry(struct smb_passwd *newpwd) @@ -742,6 +750,9 @@ Error was %s. Password file may be corrupt ! Please examine by hand !\n", in the actual file to decide how much room we have to write data. override = False, normal override = True, override XXXXXXXX'd out password or NO PASS + + do not call this function directly. use passdb.c instead. + ************************************************************************/ BOOL mod_smbpwd_entry(struct smb_passwd* pwd, BOOL override) |