diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-03-23 08:32:25 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-03-23 08:32:25 +0000 |
commit | 43ba0aa8d966b6523fc4f9b77767a820edc0c595 (patch) | |
tree | 346499e9f27ce76fe518c8a9c0031317064ba94e /source3 | |
parent | 657a24f476c90e0ffa8171f78b35a449171f54e1 (diff) | |
download | samba-43ba0aa8d966b6523fc4f9b77767a820edc0c595.tar.gz samba-43ba0aa8d966b6523fc4f9b77767a820edc0c595.tar.bz2 samba-43ba0aa8d966b6523fc4f9b77767a820edc0c595.zip |
Minor fixes:
- Fix warnings in loadparm.c
- Remove the unused 'passdb modules path' paramater
- Make pdb_ldap use $ termination rather than the workstation trust account
flag becouse some 'machine' accounts appear as normal accounts at creation
time. Also covers domains etc.
Andrew Bartlett
(This used to be commit 8c82a3daf777bcd4cd4388d30222e370fe800819)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/param/loadparm.c | 9 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 21 |
2 files changed, 17 insertions, 13 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 7e9224dcd4..6144fea63b 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -109,7 +109,6 @@ typedef struct char *szConfigFile; char *szSMBPasswdFile; char *szPrivateDir; - char *szPassdbModulePath; char *szPassdbBackend; char *szPasswordServer; char *szSocketOptions; @@ -538,9 +537,12 @@ static BOOL handle_winbind_gid(char *pszParmValue, char **ptr); static BOOL handle_non_unix_account_range(char *pszParmValue, char **ptr); static BOOL handle_wins_server_list(char *pszParmValue, char **ptr); static BOOL handle_debug_list( char *pszParmValue, char **ptr ); + +#if WITH_LDAP_SAM static BOOL handle_ldap_machine_suffix ( char *pszParmValue, char **ptr ); static BOOL handle_ldap_user_suffix ( char *pszParmValue, char **ptr ); static BOOL handle_ldap_suffix ( char *pszParmValue, char **ptr ); +#endif static void set_server_role(void); static void set_default_server_announce_type(void); @@ -706,7 +708,6 @@ static struct parm_struct parm_table[] = { {"password server", P_STRING, P_GLOBAL, &Globals.szPasswordServer, NULL, NULL, 0}, {"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL, 0}, {"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, 0}, - {"passdb module path", P_STRING, P_GLOBAL, &Globals.szPassdbModulePath, NULL, NULL, 0}, {"passdb backend", P_STRING, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, 0}, {"non unix account range", P_STRING, P_GLOBAL, &Globals.szNonUnixAccountRange, handle_non_unix_account_range, NULL, 0}, {"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, 0}, @@ -882,7 +883,7 @@ static struct parm_struct parm_table[] = { {"addprinter command", P_STRING, P_GLOBAL, &Globals.szAddPrinterCommand, NULL, NULL, 0}, {"deleteprinter command", P_STRING, P_GLOBAL, &Globals.szDeletePrinterCommand, NULL, NULL, 0}, {"show add printer wizard", P_BOOL, P_GLOBAL, &Globals.bMsAddPrinterWizard, NULL, NULL, 0}, - {"os2 driver map", P_STRING, P_GLOBAL, &Globals.szOs2DriverMap, NULL, NULL, 0}, + {"os2 driver map", P_STRING, P_GLOBAL, &Globals.szOs2DriverMap, NULL, NULL, 0}, {"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_PRINT}, {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, 0}, @@ -1221,7 +1222,6 @@ static void init_globals(void) string_set(&Globals.szSMBPasswdFile, dyn_SMB_PASSWD_FILE); string_set(&Globals.szPrivateDir, dyn_PRIVATE_DIR); - string_set(&Globals.szPassdbModulePath, ""); string_set(&Globals.szPassdbBackend, "smbpasswd"); string_set(&Globals.szGuestaccount, GUEST_ACCOUNT); @@ -1493,7 +1493,6 @@ FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile) FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile) FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile) FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir) -FN_GLOBAL_STRING(lp_passdb_module_path, &Globals.szPassdbModulePath) FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend) FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString) FN_GLOBAL_STRING(lp_printcapname, &Globals.szPrintcapname) diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 5d485977b7..8b2f5f74f4 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -1304,6 +1304,12 @@ static BOOL ldapsam_add_sam_account(struct pdb_context *context, const SAM_ACCOU int ldap_op; uint32 num_result; + const char *username = pdb_get_username(newpwd); + if (!username || !*username) { + DEBUG(0, ("Cannot add user without a username!\n")); + return False; + } + if (!ldapsam_open_connection(ldap_state, &ldap_struct)) /* open a connection to the server */ { return False; @@ -1315,7 +1321,7 @@ static BOOL ldapsam_add_sam_account(struct pdb_context *context, const SAM_ACCOU return False; } - rc = ldapsam_search_one_user_by_name (ldap_state, ldap_struct, pdb_get_username(newpwd), &result); + rc = ldapsam_search_one_user_by_name (ldap_state, ldap_struct, username, &result); if (ldap_count_entries(ldap_struct, result) != 0) { @@ -1326,12 +1332,13 @@ static BOOL ldapsam_add_sam_account(struct pdb_context *context, const SAM_ACCOU } ldap_msgfree(result); - slprintf (filter, sizeof (filter) - 1, "uid=%s", pdb_get_username(newpwd)); + slprintf (filter, sizeof (filter) - 1, "uid=%s", username); rc = ldapsam_search_one_user(ldap_state, ldap_struct, filter, &result); num_result = ldap_count_entries(ldap_struct, result); if (num_result > 1) { DEBUG (0, ("More than one user with that uid exists: bailing out!\n")); + ldap_msgfree(result); return False; } @@ -1351,11 +1358,10 @@ static BOOL ldapsam_add_sam_account(struct pdb_context *context, const SAM_ACCOU /* Check if we need to add an entry */ DEBUG(3,("Adding new user\n")); ldap_op = LDAP_MOD_ADD; - if ( pdb_get_acct_ctrl( newpwd ) & ACB_WSTRUST ) { - slprintf (dn, sizeof (dn) - 1, "uid=%s,%s", pdb_get_username(newpwd), lp_ldap_machine_suffix ()); - } - else { - slprintf (dn, sizeof (dn) - 1, "uid=%s,%s", pdb_get_username(newpwd), lp_ldap_user_suffix ()); + if (username[strlen(username)-1] == '$') { + slprintf (dn, sizeof (dn) - 1, "uid=%s,%s", username, lp_ldap_machine_suffix ()); + } else { + slprintf (dn, sizeof (dn) - 1, "uid=%s,%s", username, lp_ldap_user_suffix ()); } } @@ -1441,7 +1447,6 @@ NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co ldap_state->uri = talloc_strdup(pdb_context->mem_ctx, location); } else { ldap_state->uri = "ldap://localhost"; - return NT_STATUS_INVALID_PARAMETER; } (*pdb_method)->private_data = ldap_state; |