1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

prepare to get _nua out of the door (but back in from the window ;-)

This commit is contained in:
Simo Sorce -
parent 16302b080a
commit 09eb02cba0
4 changed files with 19 additions and 121 deletions

View File

@ -557,7 +557,6 @@ static BOOL handle_source_env(const char *pszParmValue, char **ptr);
static BOOL handle_netbios_name(const char *pszParmValue, char **ptr);
static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr);
static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr);
static BOOL handle_non_unix_account_range(const char *pszParmValue, char **ptr);
static BOOL handle_debug_list( const char *pszParmValue, char **ptr );
static BOOL handle_workgroup( const char *pszParmValue, char **ptr );
static BOOL handle_netbios_aliases( const char *pszParmValue, char **ptr );
@ -766,7 +765,6 @@ static struct parm_struct parm_table[] = {
{"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"passdb backend", P_LIST, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"non unix account range", P_STRING, P_GLOBAL, &Globals.szNonUnixAccountRange, handle_non_unix_account_range, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.AlgorithmicRidBase, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
@ -1133,7 +1131,6 @@ static struct parm_struct parm_table[] = {
{"winbind enum users", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumUsers, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind enum groups", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumGroups, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind use default domain", P_BOOL, P_GLOBAL, &Globals.bWinbindUseDefaultDomain, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind backend", P_STRING, P_GLOBAL, &Globals.szWinbindBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
};
@ -1656,7 +1653,6 @@ FN_GLOBAL_STRING(lp_acl_compatibility, &Globals.szAclCompat)
FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
FN_GLOBAL_STRING(lp_winbind_backend, &Globals.szWinbindBackend)
FN_GLOBAL_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
FN_GLOBAL_BOOL(lp_idmap_only, &Globals.bIdmapOnly)
@ -2881,7 +2877,6 @@ static BOOL handle_copy(const char *pszParmValue, char **ptr)
static uid_t idmap_uid_low, idmap_uid_high;
static gid_t idmap_gid_low, idmap_gid_high;
static uint32 non_unix_account_low, non_unix_account_high;
BOOL lp_idmap_uid(uid_t *low, uid_t *high)
{
@ -2911,20 +2906,6 @@ BOOL lp_idmap_gid(gid_t *low, gid_t *high)
return True;
}
BOOL lp_non_unix_account_range(uint32 *low, uint32 *high)
{
if (non_unix_account_low == 0 || non_unix_account_high == 0)
return False;
if (low)
*low = non_unix_account_low;
if (high)
*high = non_unix_account_high;
return True;
}
/* Do some simple checks on "idmap [ug]id" parameter values */
static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr)
@ -2961,27 +2942,6 @@ static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr)
return True;
}
/***************************************************************************
Do some simple checks on "non unix account range" parameter values.
***************************************************************************/
static BOOL handle_non_unix_account_range(const char *pszParmValue, char **ptr)
{
uint32 low, high;
if (sscanf(pszParmValue, "%u-%u", &low, &high) != 2 || high < low)
return False;
/* Parse OK */
string_set(ptr, pszParmValue);
non_unix_account_low = low;
non_unix_account_high = high;
return True;
}
/***************************************************************************
Handle the DEBUG level list.
***************************************************************************/

View File

@ -1993,6 +1993,7 @@ NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co
{
NTSTATUS nt_status;
struct smb_ldap_privates *ldap_state;
uint32 low_nua_uid, high_nua_uid;
if (!NT_STATUS_IS_OK(nt_status = make_pdb_methods(pdb_context->mem_ctx, pdb_method))) {
return nt_status;
@ -2051,40 +2052,21 @@ NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co
(*pdb_method)->free_private_data = free_private_data;
return NT_STATUS_OK;
}
if (lp_idmap_uid(&low_nua_uid, &high_nua_uid)) {
DEBUG(0, ("idmap uid range defined, non unix accounts enabled\n"));
NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
{
NTSTATUS nt_status;
struct smb_ldap_privates *ldap_state;
uint32 low_nua_uid, high_nua_uid;
ldap_state->permit_non_unix_accounts = True;
ldap_state->low_nua_rid=fallback_pdb_uid_to_user_rid(low_nua_uid);
if (!NT_STATUS_IS_OK(nt_status = pdb_init_ldapsam(pdb_context, pdb_method, location))) {
return nt_status;
ldap_state->high_nua_rid=fallback_pdb_uid_to_user_rid(high_nua_uid);
}
(*pdb_method)->name = "ldapsam_nua";
ldap_state = (*pdb_method)->private_data;
ldap_state->permit_non_unix_accounts = True;
if (!lp_non_unix_account_range(&low_nua_uid, &high_nua_uid)) {
DEBUG(0, ("cannot use ldapsam_nua without 'non unix account range' in smb.conf!\n"));
return NT_STATUS_UNSUCCESSFUL;
}
ldap_state->low_nua_rid=fallback_pdb_uid_to_user_rid(low_nua_uid);
ldap_state->high_nua_rid=fallback_pdb_uid_to_user_rid(high_nua_uid);
return NT_STATUS_OK;
}
int pdb_ldap_init(void)
{
smb_register_passdb("ldapsam", pdb_init_ldapsam, PASSDB_INTERFACE_VERSION);
smb_register_passdb("ldapsam_nua", pdb_init_ldapsam_nua, PASSDB_INTERFACE_VERSION);
return True;
}

View File

@ -1554,27 +1554,9 @@ NTSTATUS pdb_init_smbpasswd(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method,
(*pdb_method)->free_private_data = free_private_data;
return NT_STATUS_OK;
}
NTSTATUS pdb_init_smbpasswd_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
{
NTSTATUS nt_status;
struct smbpasswd_privates *privates;
if (!NT_STATUS_IS_OK(nt_status = pdb_init_smbpasswd(pdb_context, pdb_method, location))) {
return nt_status;
}
(*pdb_method)->name = "smbpasswd_nua";
privates = (*pdb_method)->private_data;
privates->permit_non_unix_accounts = True;
if (!lp_non_unix_account_range(&privates->low_nua_userid, &privates->high_nua_userid)) {
DEBUG(0, ("cannot use smbpasswd_nua without 'non unix account range' in smb.conf!\n"));
return NT_STATUS_UNSUCCESSFUL;
if (lp_idmap_uid(&privates->low_nua_userid, &privates->high_nua_userid)) {
DEBUG(0, ("idmap uid range defined, non unix accounts enabled\n"));
privates->permit_non_unix_accounts = True;
}
return NT_STATUS_OK;
@ -1583,6 +1565,5 @@ NTSTATUS pdb_init_smbpasswd_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_meth
int pdb_smbpasswd_init(void)
{
smb_register_passdb("smbpasswd", pdb_init_smbpasswd, PASSDB_INTERFACE_VERSION);
smb_register_passdb("smbpasswd_nua", pdb_init_smbpasswd_nua, PASSDB_INTERFACE_VERSION);
return True;
}

View File

@ -912,14 +912,7 @@ NTSTATUS pdb_init_tdbsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, con
{
NTSTATUS nt_status;
struct tdbsam_privates *tdb_state;
#if 0 /* when made a module use this */
tdbsam_debug_level = debug_add_class("tdbsam");
if(tdbsam_debug_level == -1) {
tdbsam_debug_level = DBGC_ALL;
DEBUG(0, ("tdbsam: Couldn't register custom debugging class!\n"));
}
#endif
uint32 low_nua_uid, high_nua_uid;
if (!NT_STATUS_IS_OK(nt_status = make_pdb_methods(pdb_context->mem_ctx, pdb_method))) {
return nt_status;
@ -959,41 +952,23 @@ NTSTATUS pdb_init_tdbsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, con
(*pdb_method)->free_private_data = free_private_data;
return NT_STATUS_OK;
}
if (lp_idmap_uid(&low_nua_uid, &high_nua_uid)) {
DEBUG(0, ("idmap uid range defined, non unix accounts enabled\n"));
NTSTATUS pdb_init_tdbsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
{
NTSTATUS nt_status;
struct tdbsam_privates *tdb_state;
uint32 low_nua_uid, high_nua_uid;
tdb_state->permit_non_unix_accounts = True;
tdb_state->low_nua_rid=fallback_pdb_uid_to_user_rid(low_nua_uid);
tdb_state->high_nua_rid=fallback_pdb_uid_to_user_rid(high_nua_uid);
if (!NT_STATUS_IS_OK(nt_status = pdb_init_tdbsam(pdb_context, pdb_method, location))) {
return nt_status;
}
(*pdb_method)->name = "tdbsam_nua";
tdb_state = (*pdb_method)->private_data;
tdb_state->permit_non_unix_accounts = True;
if (!lp_non_unix_account_range(&low_nua_uid, &high_nua_uid)) {
DEBUG(0, ("cannot use tdbsam_nua without 'non unix account range' in smb.conf!\n"));
return NT_STATUS_UNSUCCESSFUL;
}
tdb_state->low_nua_rid=fallback_pdb_uid_to_user_rid(low_nua_uid);
tdb_state->high_nua_rid=fallback_pdb_uid_to_user_rid(high_nua_uid);
return NT_STATUS_OK;
}
int pdb_tdbsam_init(void)
{
smb_register_passdb("tdbsam", pdb_init_tdbsam, PASSDB_INTERFACE_VERSION);
smb_register_passdb("tdbsam_nua", pdb_init_tdbsam_nua, PASSDB_INTERFACE_VERSION);
smb_register_passdb("tdbsam", pdb_init_tdbsam, PASSDB_INTERFACE_VERSION);
return True;
}