mirror of
https://github.com/samba-team/samba.git
synced 2025-12-11 08:23:49 +03:00
removed "default" system for password database api: all functions must
be supported. there are some stub routines in passdb.c which can be copied into a password database api which do conversion. the module writer can choose which of these to provide full support for instead of using the conversion routines.
This commit is contained in:
@@ -1555,9 +1555,9 @@ BOOL pm_process( char *FileName,
|
|||||||
|
|
||||||
/*The following definitions come from passdb.c */
|
/*The following definitions come from passdb.c */
|
||||||
|
|
||||||
|
BOOL initialize_password_db(void);
|
||||||
struct smb_passwd *iterate_getsmbpwuid(uid_t smb_userid);
|
struct smb_passwd *iterate_getsmbpwuid(uid_t smb_userid);
|
||||||
struct smb_passwd *iterate_getsmbpwnam(char *name);
|
struct smb_passwd *iterate_getsmbpwnam(char *name);
|
||||||
BOOL initialize_password_db(void);
|
|
||||||
void *startsmbpwent(BOOL update);
|
void *startsmbpwent(BOOL update);
|
||||||
void endsmbpwent(void *vp);
|
void endsmbpwent(void *vp);
|
||||||
struct smb_passwd *getsmbpwent(void *vp);
|
struct smb_passwd *getsmbpwent(void *vp);
|
||||||
@@ -1570,6 +1570,7 @@ struct smb_passwd *getsmbpwuid(uid_t smb_userid);
|
|||||||
struct sam_passwd *iterate_getsam21pwnam(char *name);
|
struct sam_passwd *iterate_getsam21pwnam(char *name);
|
||||||
struct sam_passwd *iterate_getsam21pwrid(uint32 rid);
|
struct sam_passwd *iterate_getsam21pwrid(uint32 rid);
|
||||||
struct sam_passwd *iterate_getsam21pwuid(uid_t uid);
|
struct sam_passwd *iterate_getsam21pwuid(uid_t uid);
|
||||||
|
struct sam_disp_info *getsamdispnam(char *name);
|
||||||
struct sam_disp_info *getsamdisprid(uint32 rid);
|
struct sam_disp_info *getsamdisprid(uint32 rid);
|
||||||
struct sam_disp_info *getsamdispent(void *vp);
|
struct sam_disp_info *getsamdispent(void *vp);
|
||||||
struct sam_passwd *getsam21pwent(void *vp);
|
struct sam_passwd *getsam21pwent(void *vp);
|
||||||
|
|||||||
@@ -693,6 +693,7 @@ struct passdb_ops {
|
|||||||
/*
|
/*
|
||||||
* sam query display info functions.
|
* sam query display info functions.
|
||||||
*/
|
*/
|
||||||
|
struct sam_disp_info *(*getsamdispnam)(char *);
|
||||||
struct sam_disp_info *(*getsamdisprid)(uint32);
|
struct sam_disp_info *(*getsamdisprid)(uint32);
|
||||||
struct sam_disp_info *(*getsamdispent)(void *);
|
struct sam_disp_info *(*getsamdispent)(void *);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef USE_LDAP
|
#ifdef USE_LDAP_DB
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
@@ -945,6 +945,26 @@ static BOOL mod_ldappwd_entry(struct smb_passwd* pwd, BOOL override)
|
|||||||
return mod_ldap21pwd_entry(pdb_smb_to_sam(pwd), override);
|
return mod_ldap21pwd_entry(pdb_smb_to_sam(pwd), override);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct sam_disp_info *getldapdispnam(char *name)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_dispinfo(getldap21pwnam(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sam_disp_info *getldapdisprid(uint32 rid)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_dispinfo(getldap21pwrid(rid));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sam_disp_info *getldapdispent(void *vp)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_dispinfo(getldap21pwent(vp));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sam_passwd *getldap21pwuid(uid_t uid)
|
||||||
|
{
|
||||||
|
return pdb_smb_to_sam(iterate_getsam21pwuid(pdb_uid_to_user_rid(uid)));
|
||||||
|
}
|
||||||
|
|
||||||
static struct passdb_ops ldap_ops =
|
static struct passdb_ops ldap_ops =
|
||||||
{
|
{
|
||||||
startldappwent,
|
startldappwent,
|
||||||
@@ -952,18 +972,19 @@ static struct passdb_ops ldap_ops =
|
|||||||
getldappwpos,
|
getldappwpos,
|
||||||
setldappwpos,
|
setldappwpos,
|
||||||
getldappwnam,
|
getldappwnam,
|
||||||
NULL, /* getldappwuid, */
|
getldappwuid,
|
||||||
NULL, /* getldappwent, */
|
getldappwent,
|
||||||
NULL, /* add_ldappwd_entry, */
|
add_ldappwd_entry,
|
||||||
NULL, /* mod_ldappwd_entry, */
|
mod_ldappwd_entry,
|
||||||
getldap21pwent,
|
getldap21pwent,
|
||||||
iterate_getsam21pwnam, /* From passdb.c */
|
iterate_getsam21pwnam, /* From passdb.c */
|
||||||
iterate_getsam21pwuid, /* From passdb.c */
|
iterate_getsam21pwuid, /* From passdb.c */
|
||||||
iterate_getsam21pwrid, /* From passdb.c */
|
iterate_getsam21pwrid, /* From passdb.c */
|
||||||
add_ldap21pwd_entry,
|
add_ldap21pwd_entry,
|
||||||
mod_ldap21pwd_entry,
|
mod_ldap21pwd_entry,
|
||||||
NULL, /* getsamdisprid, */
|
getldapdispnam,
|
||||||
NULL /* getsamdispent */
|
getldapdisprid,
|
||||||
|
getldapdispent
|
||||||
};
|
};
|
||||||
|
|
||||||
struct passdb_ops *ldap_initialize_password_db(void)
|
struct passdb_ops *ldap_initialize_password_db(void)
|
||||||
|
|||||||
@@ -509,24 +509,70 @@ static struct sam_passwd *getnisp21pwrid(uint32 rid)
|
|||||||
* Derived functions for NIS+.
|
* Derived functions for NIS+.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static struct smb_passwd *getnisppwent(void *vp)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_smb(getnisp21pwent(vp));
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL add_nisppwd_entry(struct smb_passwd *newpwd)
|
||||||
|
{
|
||||||
|
return add_nisp21pwd_entry(pdb_smb_to_sam(newpwd));
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL mod_nisppwd_entry(struct smb_passwd* pwd, BOOL override)
|
||||||
|
{
|
||||||
|
return mod_nisp21pwd_entry(pdb_smb_to_sam(pwd), override);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct smb_passwd *getnisppwnam(char *name)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_smb(getnisp21pwnam(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sam_passwd *getnisp21pwuid(uid_t smb_userid)
|
||||||
|
{
|
||||||
|
return getnisp21pwrid(pdb_uid_to_user_rid(smb_userid));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct smb_passwd *getnisppwuid(uid_t smb_userid)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_smb(getnisp21pwuid(smb_userid));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sam_disp_info *getnispdispnam(char *name)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_dispinfo(getnisp21pwnam(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sam_disp_info *getnispdisprid(uint32 rid)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_dispinfo(getnisp21pwrid(rid));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sam_disp_info *getnispdispent(void *vp)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_dispinfo(getnisp21pwent(vp));
|
||||||
|
}
|
||||||
|
|
||||||
static struct passdb_ops nispasswd_ops = {
|
static struct passdb_ops nispasswd_ops = {
|
||||||
startnisppwent,
|
startnisppwent,
|
||||||
endnisppwent,
|
endnisppwent,
|
||||||
getnisppwpos,
|
getnisppwpos,
|
||||||
setnisppwpos,
|
setnisppwpos,
|
||||||
NULL, /* getnispwnam, */
|
getnisppwnam,
|
||||||
NULL, /* getnispwuid, */
|
getnisppwuid,
|
||||||
NULL, /* getnispwent, */
|
getnisppwent,
|
||||||
NULL, /* add_nispwd_entry, */
|
add_nisppwd_entry,
|
||||||
NULL, /* mod_nispwd_entry, */
|
mod_nisppwd_entry,
|
||||||
getnisp21pwent,
|
getnisp21pwent,
|
||||||
getnisp21pwnam,
|
getnisp21pwnam,
|
||||||
NULL, /* getsam21pwuid */
|
getnisp21pwuid,
|
||||||
getnisp21pwrid,
|
getnisp21pwrid,
|
||||||
add_nisp21pwd_entry,
|
add_nisp21pwd_entry,
|
||||||
mod_nisp21pwd_entry,
|
mod_nisp21pwd_entry,
|
||||||
NULL, /* getsamdisprid */
|
getnispdispnam,
|
||||||
NULL /* getsamdispent */
|
getnispdisprid,
|
||||||
|
getnispdispent
|
||||||
};
|
};
|
||||||
|
|
||||||
struct passdb_ops *nisplus_initialize_password_db(void)
|
struct passdb_ops *nisplus_initialize_password_db(void)
|
||||||
|
|||||||
@@ -46,12 +46,63 @@ DOM_SID global_machine_sid;
|
|||||||
*
|
*
|
||||||
* password database writers are recommended to implement the sam_passwd
|
* password database writers are recommended to implement the sam_passwd
|
||||||
* functions in a first pass, as struct sam_passwd contains more
|
* functions in a first pass, as struct sam_passwd contains more
|
||||||
* information, needed by the NT Domain support. lkcl.
|
* information, needed by the NT Domain support.
|
||||||
|
*
|
||||||
|
* a full example set of derivative functions are listed below. an API
|
||||||
|
* writer is expected to cut/paste these into their module, replace
|
||||||
|
* either one set (struct smb_passwd) or the other (struct sam_passwd)
|
||||||
|
* OR both, and optionally also to write display info routines
|
||||||
|
* (struct sam_disp_info). lkcl
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static struct smb_passwd *getPDBpwent (void *vp) { return pdb_sam_to_smb(getPDB21pwent(vp)); }
|
||||||
|
static BOOL add_PDBpwd_entry (struct smb_passwd *newpwd) { return add_PDB21pwd_entry(pdb_smb_to_sam(newpwd)); }
|
||||||
|
static BOOL mod_PDBpwd_entry (struct smb_passwd* pwd, BOOL override) { return mod_PDB21pwd_entry(pdb_smb_to_sam(pwd), override); }
|
||||||
|
static struct smb_passwd *getPDBpwnam (char *name) { return pdb_sam_to_smb(getPDB21pwnam(name)); }
|
||||||
|
static struct smb_passwd *getPDBpwuid (uid_t smb_userid) { return pdb_sam_to_smb(getPDB21pwuid(pdb_uid_to_user_rid(smb_userid))); }
|
||||||
|
|
||||||
|
static struct sam_passwd *getPDB21pwent (void *vp) { return pdb_smb_to_sam(getPDBpwent(vp)); }
|
||||||
|
static BOOL add_PDB21pwd_entry (struct sam_passwd *newpwd) { return add_PDBpwd_entry(pdb_sam_to_smb(newpwd)); }
|
||||||
|
static BOOL mod_PDB21pwd_entry (struct sam_passwd* pwd, BOOL override) { return mod_PDBpwd_entry(pdb_sam_to_smb(pwd), override); }
|
||||||
|
static struct sam_passwd *getPDB21pwnam (char *name) { return pdb_smb_to_sam(getPDBpwnam(name)); }
|
||||||
|
static struct sam_passwd *getPDB21pwrid (uint32 rid) { return pdb_smb_to_sam(getPDBpwuid(pdb_user_rid_to_uid(rid))); }
|
||||||
|
static struct sam_passwd *getPDB21pwuid (uid_t uid) { return pdb_smb_to_sam(getPDBpwuid(uid)); }
|
||||||
|
|
||||||
|
static struct sam_disp_info *getPDBdispnam (char *name) { return pdb_sam_to_dispinfo(getPDB21pwnam(name)); }
|
||||||
|
static struct sam_disp_info *getPDBdisprid (uint32 rid) { return pdb_sam_to_dispinfo(getPDB21pwrid(rid)); }
|
||||||
|
static struct sam_disp_info *getPDBdispent (void *vp) { return pdb_sam_to_dispinfo(getPDB21pwent(vp)); }
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
static struct passdb_ops *pdb_ops;
|
static struct passdb_ops *pdb_ops;
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
Initialize the password db operations.
|
||||||
|
***************************************************************/
|
||||||
|
|
||||||
|
BOOL initialize_password_db(void)
|
||||||
|
{
|
||||||
|
if (pdb_ops)
|
||||||
|
{
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_NISPLUS_DB
|
||||||
|
pdb_ops = nisplus_initialize_password_db();
|
||||||
|
#endif /* USE_NISPLUS_DB */
|
||||||
|
|
||||||
|
#ifdef USE_LDAP_DB
|
||||||
|
pdb_ops = ldap_initialize_password_db();
|
||||||
|
#endif /* USE_LDAP_DB */
|
||||||
|
|
||||||
|
#ifdef USE_SMBPASS_DB
|
||||||
|
pdb_ops = file_initialize_password_db();
|
||||||
|
#endif /* USE_SMBPASS_DB */
|
||||||
|
|
||||||
|
return (pdb_ops != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions that return/manipulate a struct smb_passwd.
|
* Functions that return/manipulate a struct smb_passwd.
|
||||||
*/
|
*/
|
||||||
@@ -122,32 +173,6 @@ struct smb_passwd *iterate_getsmbpwnam(char *name)
|
|||||||
return pwd;
|
return pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************
|
|
||||||
Initialize the password db operations.
|
|
||||||
***************************************************************/
|
|
||||||
|
|
||||||
BOOL initialize_password_db(void)
|
|
||||||
{
|
|
||||||
if (pdb_ops)
|
|
||||||
{
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_NISPLUS_DB
|
|
||||||
pdb_ops = nisplus_initialize_password_db();
|
|
||||||
#endif /* USE_NISPLUS_DB */
|
|
||||||
|
|
||||||
#ifdef USE_LDAP_DB
|
|
||||||
pdb_ops = ldap_initialize_password_db();
|
|
||||||
#endif /* USE_LDAP_DB */
|
|
||||||
|
|
||||||
#ifdef USE_SMBPASS_DB
|
|
||||||
pdb_ops = file_initialize_password_db();
|
|
||||||
#endif /* USE_SMBPASS_DB */
|
|
||||||
|
|
||||||
return (pdb_ops != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
Start to enumerate the smb or sam passwd list. Returns a void pointer
|
Start to enumerate the smb or sam passwd list. Returns a void pointer
|
||||||
to ensure no modification outside this module.
|
to ensure no modification outside this module.
|
||||||
@@ -185,19 +210,7 @@ void endsmbpwent(void *vp)
|
|||||||
|
|
||||||
struct smb_passwd *getsmbpwent(void *vp)
|
struct smb_passwd *getsmbpwent(void *vp)
|
||||||
{
|
{
|
||||||
if (pdb_ops->getsmbpwent == NULL && pdb_ops->getsam21pwent == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("getsmbpwent: getsmbpwent() and getsam21pwent() not supported!\n"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (pdb_ops->getsmbpwent != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->getsmbpwent(vp);
|
return pdb_ops->getsmbpwent(vp);
|
||||||
}
|
|
||||||
return pdb_sam_to_smb(pdb_ops->getsam21pwent(vp));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -238,19 +251,7 @@ BOOL setsmbpwpos(void *vp, unsigned long tok)
|
|||||||
|
|
||||||
BOOL add_smbpwd_entry(struct smb_passwd *newpwd)
|
BOOL add_smbpwd_entry(struct smb_passwd *newpwd)
|
||||||
{
|
{
|
||||||
if (pdb_ops->add_smbpwd_entry == NULL && pdb_ops->add_sam21pwd_entry == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("add_smbpwd_entry: add_smbpwd_entry() and add_sam21pwd_entry() not supported!\n"));
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
if (pdb_ops->add_smbpwd_entry != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->add_smbpwd_entry(newpwd);
|
return pdb_ops->add_smbpwd_entry(newpwd);
|
||||||
}
|
|
||||||
return pdb_ops->add_sam21pwd_entry(pdb_smb_to_sam(newpwd));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -264,19 +265,7 @@ BOOL add_smbpwd_entry(struct smb_passwd *newpwd)
|
|||||||
|
|
||||||
BOOL mod_smbpwd_entry(struct smb_passwd* pwd, BOOL override)
|
BOOL mod_smbpwd_entry(struct smb_passwd* pwd, BOOL override)
|
||||||
{
|
{
|
||||||
if (pdb_ops->mod_smbpwd_entry == NULL && pdb_ops->mod_sam21pwd_entry == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("mod_smbpwd_entry: mod_smbpwd_entry() and mod_sam21pwd_entry() not supported!\n"));
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
if (pdb_ops->mod_smbpwd_entry != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->mod_smbpwd_entry(pwd, override);
|
return pdb_ops->mod_smbpwd_entry(pwd, override);
|
||||||
}
|
|
||||||
return pdb_ops->mod_sam21pwd_entry(pdb_smb_to_sam(pwd), override);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -285,19 +274,7 @@ BOOL mod_smbpwd_entry(struct smb_passwd* pwd, BOOL override)
|
|||||||
|
|
||||||
struct smb_passwd *getsmbpwnam(char *name)
|
struct smb_passwd *getsmbpwnam(char *name)
|
||||||
{
|
{
|
||||||
if (pdb_ops->getsmbpwnam == NULL && pdb_ops->getsam21pwnam == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("getsmbpwnam: getsmbpwnam() and getsam21pwnam() not supported!\n"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (pdb_ops->getsam21pwnam != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->getsmbpwnam(name);
|
return pdb_ops->getsmbpwnam(name);
|
||||||
}
|
|
||||||
return pdb_sam_to_smb(getsam21pwnam(name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -306,19 +283,7 @@ struct smb_passwd *getsmbpwnam(char *name)
|
|||||||
|
|
||||||
struct smb_passwd *getsmbpwuid(uid_t smb_userid)
|
struct smb_passwd *getsmbpwuid(uid_t smb_userid)
|
||||||
{
|
{
|
||||||
if (pdb_ops->getsmbpwuid == NULL && pdb_ops->getsam21pwrid == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("getsmbpwuid: getsmbpwuid() and getsam21pwrid() not supported!\n"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (pdb_ops->getsmbpwuid != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->getsmbpwuid(smb_userid);
|
return pdb_ops->getsmbpwuid(smb_userid);
|
||||||
}
|
|
||||||
return pdb_sam_to_smb(pdb_ops->getsam21pwuid(pdb_uid_to_user_rid(smb_userid)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -432,16 +397,20 @@ struct sam_passwd *iterate_getsam21pwuid(uid_t uid)
|
|||||||
return pwd;
|
return pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Routine to return a display info structure, by name
|
||||||
|
*************************************************************************/
|
||||||
|
struct sam_disp_info *getsamdispnam(char *name)
|
||||||
|
{
|
||||||
|
return pdb_ops->getsamdispnam(name);
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Routine to return a display info structure, by rid
|
Routine to return a display info structure, by rid
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
struct sam_disp_info *getsamdisprid(uint32 rid)
|
struct sam_disp_info *getsamdisprid(uint32 rid)
|
||||||
{
|
{
|
||||||
if (pdb_ops->getsamdisprid != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->getsamdisprid(rid);
|
return pdb_ops->getsamdisprid(rid);
|
||||||
}
|
|
||||||
return pdb_sam_to_dispinfo(pdb_ops->getsam21pwrid(rid));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -449,11 +418,7 @@ struct sam_disp_info *getsamdisprid(uint32 rid)
|
|||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
struct sam_disp_info *getsamdispent(void *vp)
|
struct sam_disp_info *getsamdispent(void *vp)
|
||||||
{
|
{
|
||||||
if (pdb_ops->getsamdispent != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->getsamdispent(vp);
|
return pdb_ops->getsamdispent(vp);
|
||||||
}
|
|
||||||
return pdb_sam_to_dispinfo(pdb_ops->getsam21pwent(vp));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -462,19 +427,7 @@ struct sam_disp_info *getsamdispent(void *vp)
|
|||||||
|
|
||||||
struct sam_passwd *getsam21pwent(void *vp)
|
struct sam_passwd *getsam21pwent(void *vp)
|
||||||
{
|
{
|
||||||
if (pdb_ops->getsmbpwent == NULL && pdb_ops->getsam21pwent == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("getsmbpwent: getsmbpwent() and getsam21pwent() not supported!\n"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (pdb_ops->getsam21pwent != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->getsam21pwent(vp);
|
return pdb_ops->getsam21pwent(vp);
|
||||||
}
|
|
||||||
return pdb_smb_to_sam(pdb_ops->getsmbpwent(vp));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -483,19 +436,7 @@ struct sam_passwd *getsam21pwent(void *vp)
|
|||||||
|
|
||||||
BOOL add_sam21pwd_entry(struct sam_passwd *newpwd)
|
BOOL add_sam21pwd_entry(struct sam_passwd *newpwd)
|
||||||
{
|
{
|
||||||
if (pdb_ops->add_smbpwd_entry == NULL && pdb_ops->add_sam21pwd_entry == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("add_smbpwd_entry: add_smbpwd_entry() and add_sam21pwd_entry() not supported!\n"));
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
if (pdb_ops->add_sam21pwd_entry != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->add_sam21pwd_entry(newpwd);
|
return pdb_ops->add_sam21pwd_entry(newpwd);
|
||||||
}
|
|
||||||
return pdb_ops->add_smbpwd_entry(pdb_sam_to_smb(newpwd));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -509,19 +450,7 @@ BOOL add_sam21pwd_entry(struct sam_passwd *newpwd)
|
|||||||
|
|
||||||
BOOL mod_sam21pwd_entry(struct sam_passwd* pwd, BOOL override)
|
BOOL mod_sam21pwd_entry(struct sam_passwd* pwd, BOOL override)
|
||||||
{
|
{
|
||||||
if (pdb_ops->mod_smbpwd_entry == NULL && pdb_ops->mod_sam21pwd_entry == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("mod_smbpwd_entry: mod_smbpwd_entry() and mod_sam21pwd_entry() not supported!\n"));
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
if (pdb_ops->mod_sam21pwd_entry != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->mod_sam21pwd_entry(pwd, override);
|
return pdb_ops->mod_sam21pwd_entry(pwd, override);
|
||||||
}
|
|
||||||
return pdb_ops->mod_smbpwd_entry(pdb_sam_to_smb(pwd), override);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -531,19 +460,7 @@ BOOL mod_sam21pwd_entry(struct sam_passwd* pwd, BOOL override)
|
|||||||
|
|
||||||
struct sam_passwd *getsam21pwnam(char *name)
|
struct sam_passwd *getsam21pwnam(char *name)
|
||||||
{
|
{
|
||||||
if (pdb_ops->getsmbpwnam == NULL && pdb_ops->getsam21pwnam == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("getsam21pwnam: getsmbpwnam() and getsam21pwnam() not supported!\n"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (pdb_ops->getsam21pwnam != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->getsam21pwnam(name);
|
return pdb_ops->getsam21pwnam(name);
|
||||||
}
|
|
||||||
return pdb_smb_to_sam(getsmbpwnam(name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -552,19 +469,7 @@ struct sam_passwd *getsam21pwnam(char *name)
|
|||||||
|
|
||||||
struct sam_passwd *getsam21pwrid(uint32 rid)
|
struct sam_passwd *getsam21pwrid(uint32 rid)
|
||||||
{
|
{
|
||||||
if (pdb_ops->getsmbpwuid == NULL && pdb_ops->getsam21pwrid == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("getsam21pwrid: getsmbpwuid() and getsam21pwrid() not supported!\n"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (pdb_ops->getsam21pwrid != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->getsam21pwrid(rid);
|
return pdb_ops->getsam21pwrid(rid);
|
||||||
}
|
|
||||||
return pdb_smb_to_sam(pdb_ops->getsmbpwuid(pdb_user_rid_to_uid(rid)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -573,22 +478,12 @@ struct sam_passwd *getsam21pwrid(uint32 rid)
|
|||||||
|
|
||||||
struct sam_passwd *getsam21pwuid(uid_t uid)
|
struct sam_passwd *getsam21pwuid(uid_t uid)
|
||||||
{
|
{
|
||||||
if (pdb_ops->getsmbpwuid == NULL && pdb_ops->getsam21pwrid == NULL)
|
|
||||||
{
|
|
||||||
/* must have one or the other: this is an error by the password
|
|
||||||
database implementor for the back-end you are using.
|
|
||||||
*/
|
|
||||||
DEBUG(0,("getsam21pwuid: getsmbpwuid() and getsam21pwrid() not supported!\n"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (pdb_ops->getsam21pwuid != NULL)
|
|
||||||
{
|
|
||||||
return pdb_ops->getsam21pwuid(uid);
|
return pdb_ops->getsam21pwuid(uid);
|
||||||
}
|
|
||||||
return pdb_smb_to_sam(pdb_ops->getsmbpwuid(uid));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************
|
/**********************************************************
|
||||||
**********************************************************
|
**********************************************************
|
||||||
|
|
||||||
@@ -1143,3 +1038,4 @@ BOOL pdb_rid_is_user(uint32 rid)
|
|||||||
*/
|
*/
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -920,6 +920,21 @@ BOOL mod_smbfilepwd_entry(struct smb_passwd* pwd, BOOL override)
|
|||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct sam_disp_info *getsmbfiledispnam(char *name)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_dispinfo(pdb_ops->getsmbfile21pwnam(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sam_disp_info *getsmbfiledisprid(uint32 rid)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_dispinfo(pdb_ops->getsmbfile21pwrid(rid));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sam_disp_info *getsmbfiledispent(void *vp)
|
||||||
|
{
|
||||||
|
return pdb_sam_to_dispinfo(pdb_ops->getsmbfile21pwent(vp));
|
||||||
|
}
|
||||||
|
|
||||||
static struct passdb_ops file_ops = {
|
static struct passdb_ops file_ops = {
|
||||||
startsmbfilepwent,
|
startsmbfilepwent,
|
||||||
endsmbfilepwent,
|
endsmbfilepwent,
|
||||||
@@ -936,6 +951,9 @@ static struct passdb_ops file_ops = {
|
|||||||
iterate_getsam21pwrid, /* In passdb.c */
|
iterate_getsam21pwrid, /* In passdb.c */
|
||||||
add_smbfile21pwd_entry,
|
add_smbfile21pwd_entry,
|
||||||
mod_smbfile21pwd_entry
|
mod_smbfile21pwd_entry
|
||||||
|
getsmbfiledispnam,
|
||||||
|
getsmbfiledisprid,
|
||||||
|
getsmbfiledispent
|
||||||
};
|
};
|
||||||
|
|
||||||
struct passdb_ops *file_initialize_password_db(void)
|
struct passdb_ops *file_initialize_password_db(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user