You can subscribe to this list here.
2006 |
Jan
|
Feb
(12) |
Mar
(41) |
Apr
|
May
|
Jun
(3) |
Jul
(2) |
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
(20) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(33) |
Jul
(18) |
Aug
(20) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(12) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <he...@us...> - 2013-06-12 18:25:03
|
Revision: 185 http://sourceforge.net/p/pdbsql/code/185 Author: herwinw Date: 2013-06-12 18:25:00 +0000 (Wed, 12 Jun 2013) Log Message: ----------- Removed extraneous parentheses Now we can compile with clang without errors. Modified Paths: -------------- branches/pdbsql_36/pdb_mysql.c branches/pdbsql_36/pdb_pgsql.c Modified: branches/pdbsql_36/pdb_mysql.c =================================================================== --- branches/pdbsql_36/pdb_mysql.c 2013-05-24 10:21:44 UTC (rev 184) +++ branches/pdbsql_36/pdb_mysql.c 2013-06-12 18:25:00 UTC (rev 185) @@ -445,7 +445,7 @@ state->current += 1; - if ((entry->account_name == NULL)) { + if (entry->account_name == NULL) { DEBUG(0, ("talloc_strdup failed\n")); return false; } Modified: branches/pdbsql_36/pdb_pgsql.c =================================================================== --- branches/pdbsql_36/pdb_pgsql.c 2013-05-24 10:21:44 UTC (rev 184) +++ branches/pdbsql_36/pdb_pgsql.c 2013-06-12 18:25:00 UTC (rev 185) @@ -489,7 +489,7 @@ search_state->currow++; - if ((entry->account_name == NULL)) { + if (entry->account_name == NULL) { DEBUG(0, ("talloc_strdup failed\n")); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-05-24 10:21:48
|
Revision: 184 http://sourceforge.net/p/pdbsql/code/184 Author: herwinw Date: 2013-05-24 10:21:44 +0000 (Fri, 24 May 2013) Log Message: ----------- Fixed a compile warning on 64bit platforms Incompatible types Modified Paths: -------------- branches/pdbsql_36/pdb_multi.c Modified: branches/pdbsql_36/pdb_multi.c =================================================================== --- branches/pdbsql_36/pdb_multi.c 2013-05-11 08:25:03 UTC (rev 183) +++ branches/pdbsql_36/pdb_multi.c 2013-05-24 10:21:44 UTC (rev 184) @@ -286,7 +286,7 @@ struct samu *user, struct dom_sid **pp_sids, gid_t **pp_gids, - size_t *p_num_groups) + uint32_t *p_num_groups) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-05-11 08:25:09
|
Revision: 183 http://sourceforge.net/p/pdbsql/code/183 Author: herwinw Date: 2013-05-11 08:25:03 +0000 (Sat, 11 May 2013) Log Message: ----------- Enabled a number of methods Code courtesy of Gary Mills. This should prevent some segfaults, see bugreport 11. Modified Paths: -------------- branches/pdbsql_36/pdb_multi.c Modified: branches/pdbsql_36/pdb_multi.c =================================================================== --- branches/pdbsql_36/pdb_multi.c 2013-05-11 07:57:17 UTC (rev 182) +++ branches/pdbsql_36/pdb_multi.c 2013-05-11 08:25:03 UTC (rev 183) @@ -164,10 +164,10 @@ return true; } -#if 0 static bool multisam_search_groups(struct pdb_methods *methods, struct pdb_search *search) { + talloc_set_destructor(search, NULL); return false; } @@ -175,16 +175,17 @@ struct pdb_search *search, const struct dom_sid *sid) { + talloc_set_destructor(search, NULL); return false; } -static NTSTATUS multisam_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value) +static NTSTATUS multisam_get_account_policy(struct pdb_methods *methods, enum pdb_policy_type type, uint32 *value) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } -static NTSTATUS multisam_set_account_policy(struct pdb_methods *methods, int policy_index, uint32 value) +static NTSTATUS multisam_set_account_policy(struct pdb_methods *methods, enum pdb_policy_type type, uint32 value) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -195,7 +196,6 @@ DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } -#endif /* Tries gid_to_sid on every backend until one succeeds, returns true on success */ static bool multisam_gid_to_sid(struct pdb_methods *methods, gid_t gid, @@ -242,16 +242,6 @@ return false; } -#if 0 -static NTSTATUS multisam_set_unix_primary_group(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, - struct samu *sampass) -{ - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; -} -#endif - static NTSTATUS multisam_create_user(struct pdb_methods *methods, TALLOC_CTX *tmp_ctx, const char *name, uint32 acb_info, uint32 *rid) @@ -291,7 +281,6 @@ return NT_STATUS_UNSUCCESSFUL; } -#if 0 static NTSTATUS multisam_enum_group_memberships(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, struct samu *user, @@ -350,7 +339,6 @@ DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } -#endif static NTSTATUS multisam_add_group_mapping_entry(struct pdb_methods *methods, GROUP_MAP *map) @@ -410,9 +398,8 @@ return NT_STATUS_UNSUCCESSFUL; } -#if 0 static NTSTATUS multisam_enum_group_mapping(struct pdb_methods *methods, - const struct dom_sid *sid, enum SID_NAME_USE sid_name_use, + const struct dom_sid *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, size_t *p_num_entries, bool unix_only) { @@ -420,12 +407,14 @@ return NT_STATUS_NOT_IMPLEMENTED; } +#if 0 static NTSTATUS multisam_find_alias(struct pdb_methods *methods, const char *name, struct dom_sid *sid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } +#endif static NTSTATUS multisam_create_alias(struct pdb_methods *methods, const char *name, uint32 *rid) @@ -472,8 +461,8 @@ } NTSTATUS multisam_enum_aliasmem(struct pdb_methods *methods, - const struct dom_sid *alias, struct dom_sid **pp_members, - size_t *p_num_members) + const struct dom_sid *alias, TALLOC_CTX *mem_ctx, + struct dom_sid **pp_members, size_t *p_num_members) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -490,10 +479,9 @@ DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } -#endif +/* Creates user list in every backend */ #if 0 -/* Creates user list in every backend */ static NTSTATUS multisam_setsampwent(struct pdb_methods *methods, bool update, uint32 acb_mask) { short i; @@ -672,7 +660,6 @@ } -#if 0 static NTSTATUS multisam_lookup_rids(struct pdb_methods *methods, const struct dom_sid *domain_sid, int num_rids, @@ -709,7 +696,6 @@ DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } -#endif /* The capabilities of the first backend is used. */ /* FIXME This should combine the capabilities from all the backends */ @@ -773,8 +759,6 @@ (*pdb_method)->sid_to_id = multisam_sid_to_id; - /* Not yet implemented here */ -#if 0 (*pdb_method)->update_login_attempts = multisam_update_login_attempts; (*pdb_method)->getgrsid = multisam_getgrsid; (*pdb_method)->getgrgid = multisam_getgrgid; @@ -786,7 +770,6 @@ (*pdb_method)->enum_group_memberships = multisam_enum_group_memberships; (*pdb_method)->add_groupmem = multisam_add_groupmem; (*pdb_method)->del_groupmem = multisam_del_groupmem; - (*pdb_method)->find_alias = multisam_find_alias; (*pdb_method)->create_alias = multisam_create_alias; (*pdb_method)->delete_alias = multisam_delete_alias; (*pdb_method)->get_aliasinfo = multisam_get_aliasinfo; @@ -802,6 +785,9 @@ (*pdb_method)->search_users = multisam_search_users; (*pdb_method)->search_groups = multisam_search_groups; (*pdb_method)->search_aliases = multisam_search_aliases; + /* Not yet implemented here */ +#if 0 + (*pdb_method)->find_alias = multisam_find_alias; #endif if (!location) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-05-11 07:57:20
|
Revision: 182 http://sourceforge.net/p/pdbsql/code/182 Author: herwinw Date: 2013-05-11 07:57:17 +0000 (Sat, 11 May 2013) Log Message: ----------- Removed the PDB_CAP_STORE_RIDS capability from pdb_mysql The same fix as in r178, but this time for mysql instead of postgresql Revision Links: -------------- http://sourceforge.net/p/pdbsql/code/178 Modified Paths: -------------- branches/pdbsql_36/pdb_mysql.c Modified: branches/pdbsql_36/pdb_mysql.c =================================================================== --- branches/pdbsql_36/pdb_mysql.c 2013-05-11 07:53:35 UTC (rev 181) +++ branches/pdbsql_36/pdb_mysql.c 2013-05-11 07:57:17 UTC (rev 182) @@ -408,13 +408,9 @@ } static uint32_t mysqlsam_capabilities (struct pdb_methods *pdb_methods) { - return PDB_CAP_STORE_RIDS | PDB_CAP_ADS; + return PDB_CAP_ADS; } -static bool mysqlsam_new_rid (struct pdb_methods *pdb_methods, uint32 *rid) { - return false; -} - struct mysqlsam_search_state { uint32_t acct_flags; @@ -560,7 +556,6 @@ (*pdb_method)->update_sam_account = mysqlsam_update_sam_account; (*pdb_method)->delete_sam_account = mysqlsam_delete_sam_account; (*pdb_method)->capabilities = mysqlsam_capabilities; - (*pdb_method)->new_rid = mysqlsam_new_rid; data = talloc(*pdb_method, struct pdb_mysql_data); (*pdb_method)->private_data = data; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-05-11 07:53:38
|
Revision: 181 http://sourceforge.net/p/pdbsql/code/181 Author: herwinw Date: 2013-05-11 07:53:35 +0000 (Sat, 11 May 2013) Log Message: ----------- Added some dummy search functions See bug 11. Code provided by Gary Mills. Modified Paths: -------------- branches/pdbsql_36/pdb_mysql.c branches/pdbsql_36/pdb_pgsql.c Modified: branches/pdbsql_36/pdb_mysql.c =================================================================== --- branches/pdbsql_36/pdb_mysql.c 2013-05-11 07:40:03 UTC (rev 180) +++ branches/pdbsql_36/pdb_mysql.c 2013-05-11 07:53:35 UTC (rev 181) @@ -517,6 +517,23 @@ return true; } +/* Dummy search_ functions. Maybe they should really work XXXX */ +/* Courtesy of Gary Mills */ +static bool mysqlsam_search_groups(struct pdb_methods *methods, + struct pdb_search *search) +{ + talloc_set_destructor(search, NULL); + return false; +} + +static bool mysqlsam_search_aliases(struct pdb_methods *methods, + struct pdb_search *search, + const struct dom_sid *sid) +{ + talloc_set_destructor(search, NULL); + return false; +} + static NTSTATUS mysqlsam_init(struct pdb_methods **pdb_method, const char *location) { NTSTATUS nt_status; @@ -535,6 +552,8 @@ (*pdb_method)->name = "mysqlsam"; (*pdb_method)->search_users = mysqlsam_search_users; + (*pdb_method)->search_groups = mysqlsam_search_groups; + (*pdb_method)->search_aliases = mysqlsam_search_aliases; (*pdb_method)->getsampwnam = mysqlsam_getsampwnam; (*pdb_method)->getsampwsid = mysqlsam_getsampwsid; (*pdb_method)->add_sam_account = mysqlsam_add_sam_account; Modified: branches/pdbsql_36/pdb_pgsql.c =================================================================== --- branches/pdbsql_36/pdb_pgsql.c 2013-05-11 07:40:03 UTC (rev 180) +++ branches/pdbsql_36/pdb_pgsql.c 2013-05-11 07:53:35 UTC (rev 181) @@ -564,6 +564,24 @@ return true; } +/* Dummy search_ functions. Maybe they should really work XXXX */ +/* Courtesy of Gary Mills */ +static bool pgsqlsam_search_groups(struct pdb_methods *methods, + struct pdb_search *search) +{ + talloc_set_destructor(search, NULL); + return false; +} + +static bool pgsqlsam_search_aliases(struct pdb_methods *methods, + struct pdb_search *search, + const struct dom_sid *sid) +{ + talloc_set_destructor(search, NULL); + return false; +} + + static NTSTATUS pgsqlsam_init (struct pdb_methods **pdb_method, const char *location) { NTSTATUS nt_status; @@ -585,6 +603,8 @@ (*pdb_method)->name = "pgsqlsam"; (*pdb_method)->search_users = pgsqlsam_search_users; + (*pdb_method)->search_groups = pgsqlsam_search_groups; + (*pdb_method)->search_aliases = pgsqlsam_search_aliases; (*pdb_method)->getsampwnam = pgsqlsam_getsampwnam; (*pdb_method)->getsampwsid = pgsqlsam_getsampwsid; (*pdb_method)->add_sam_account = pgsqlsam_add_sam_account; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-05-11 07:40:07
|
Revision: 180 http://sourceforge.net/p/pdbsql/code/180 Author: herwinw Date: 2013-05-11 07:40:03 +0000 (Sat, 11 May 2013) Log Message: ----------- Fixed the validation of the pq result It actually broke in r162, and the fix in r178 wasn't as strict as the one we had before. Revision Links: -------------- http://sourceforge.net/p/pdbsql/code/162 http://sourceforge.net/p/pdbsql/code/178 Modified Paths: -------------- branches/pdbsql_36/pdb_pgsql.c Modified: branches/pdbsql_36/pdb_pgsql.c =================================================================== --- branches/pdbsql_36/pdb_pgsql.c 2013-05-11 07:28:13 UTC (rev 179) +++ branches/pdbsql_36/pdb_pgsql.c 2013-05-11 07:40:03 UTC (rev 180) @@ -121,7 +121,7 @@ return handle; } -static PGresult *pdb_pgsql_query(struct pdb_pgsql_data *data, char *query) +static PGresult *pdb_pgsql_query(struct pdb_pgsql_data *data, char *query, bool expect_resultset) { PGresult *result; @@ -146,8 +146,7 @@ DEBUG(1, ("Error executing %s, %s (trying to recover with reconnect)\n", query, PQerrorMessage(data->handle))); PQreset(data->handle); } else { - int status = PQresultStatus(result); - if (status != PGRES_TUPLES_OK && status != PGRES_COMMAND_OK) { + if (PQresultStatus(result) != (expect_resultset ? PGRES_TUPLES_OK : PGRES_COMMAND_OK)) { DEBUG(1, ("Error executing %s, %s\n", query, PQresultErrorMessage(result))); PQclear(result); result = NULL; @@ -282,7 +281,7 @@ PQescapeString(esc, sname, strlen(sname)); query = sql_account_query_select(NULL, data->location, true, field, esc); - result = pdb_pgsql_query(data, query); + result = pdb_pgsql_query(data, query, true); /* Result? */ if (result == NULL) @@ -379,7 +378,7 @@ PQescapeString(esc, sname, strlen(sname)); query = sql_account_query_delete(NULL, data->location, esc); - result = pdb_pgsql_query(data, query); + result = pdb_pgsql_query(data, query, false); if (result == NULL) { retval = NT_STATUS_UNSUCCESSFUL; @@ -421,7 +420,7 @@ } /* Execute the query */ - result = pdb_pgsql_query(data, query); + result = pdb_pgsql_query(data, query, false); if (result == NULL) { retval = NT_STATUS_INVALID_PARAMETER; @@ -548,7 +547,7 @@ /* The query to select all the users */ query = sql_account_query_select(NULL, data->location, false, SQL_SEARCH_NONE, NULL); - search_state->pwent = pdb_pgsql_query(data, query); + search_state->pwent = pdb_pgsql_query(data, query, true); search_state->currow = 0; talloc_free(query); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-05-11 07:28:19
|
Revision: 179 http://sourceforge.net/p/pdbsql/code/179 Author: herwinw Date: 2013-05-11 07:28:13 +0000 (Sat, 11 May 2013) Log Message: ----------- Removed compatibility ifdefs for samba 3.4 This version is not supposed to run on samba 3.4, so we probably shouldn't bother keeping them in the codebase. Modified Paths: -------------- branches/pdbsql_36/pdb_multi.c branches/pdbsql_36/pdb_mysql.c branches/pdbsql_36/pdb_pgsql.c branches/pdbsql_36/pdb_sql.c Modified: branches/pdbsql_36/pdb_multi.c =================================================================== --- branches/pdbsql_36/pdb_multi.c 2013-05-10 21:20:29 UTC (rev 178) +++ branches/pdbsql_36/pdb_multi.c 2013-05-11 07:28:13 UTC (rev 179) @@ -197,30 +197,6 @@ } #endif -#if PASSDB_INTERFACE_VERSION < 19 -/* Tries uid_to_rid on every backend until one succeeds, returns true on success */ -static bool multisam_uid_to_rid(struct pdb_methods *methods, uid_t uid, - uint32 *rid) -{ - short i; - struct multisam_data *data; - bool rv; - - if (!methods) return false; - data = (struct multisam_data *)methods->private_data; - if (!data) return false; - - for (i = 0; i < data->num_backends; i++) { - rv = data->methods[i]->uid_to_rid(data->methods[i], uid, rid); - if (rv == true) { - return true; - } - } - - return false; -} -#endif - /* Tries gid_to_sid on every backend until one succeeds, returns true on success */ static bool multisam_gid_to_sid(struct pdb_methods *methods, gid_t gid, struct dom_sid *sid) @@ -290,15 +266,9 @@ /* Get a new free rid if necessary */ -#if PASSDB_INTERFACE_VERSION < 19 - if (data->methods[0]->rid_algorithm(data->methods[0])) { - multisam_new_rid(methods, rid, 0); - } -#else if (data->methods[0]->capabilities(data->methods[0])) { multisam_new_rid(methods, rid, 0); } -#endif return data->methods[0]->create_user(data->methods[0], tmp_ctx, name, acb_info, rid); } @@ -741,19 +711,13 @@ } #endif -#if PASSDB_INTERFACE_VERSION < 19 -/* The rid algorithm of the first backend is used. */ -static bool multisam_rid_algorithm (struct pdb_methods *methods) -{ - return true; -} -#else /* The capabilities of the first backend is used. */ +/* FIXME This should combine the capabilities from all the backends */ static uint32_t multisam_capabilities (struct pdb_methods *methods) { return PDB_CAP_STORE_RIDS | PDB_CAP_ADS; } -#endif + /* This function is a fallback for errors */ static bool multisam_dummy_new_rid (struct pdb_methods *methods, uint32 *rid) { @@ -800,18 +764,11 @@ (*pdb_method)->update_sam_account = multisam_update_sam_account; (*pdb_method)->delete_sam_account = multisam_delete_sam_account; (*pdb_method)->rename_sam_account = multisam_rename_sam_account; -#if PASSDB_INTERFACE_VERSION < 19 - (*pdb_method)->rid_algorithm = multisam_rid_algorithm; -#else (*pdb_method)->capabilities = multisam_capabilities; -#endif (*pdb_method)->new_rid = multisam_dummy_new_rid; (*pdb_method)->create_user = multisam_create_user; (*pdb_method)->delete_user = multisam_delete_user; -#if PASSDB_INTERFACE_VERSION < 19 - (*pdb_method)->uid_to_rid = multisam_uid_to_rid; -#endif (*pdb_method)->gid_to_sid = multisam_gid_to_sid; (*pdb_method)->sid_to_id = multisam_sid_to_id; Modified: branches/pdbsql_36/pdb_mysql.c =================================================================== --- branches/pdbsql_36/pdb_mysql.c 2013-05-10 21:20:29 UTC (rev 178) +++ branches/pdbsql_36/pdb_mysql.c 2013-05-11 07:28:13 UTC (rev 179) @@ -407,15 +407,10 @@ return mysqlsam_replace_sam_account(methods, newpwd, 1); } -#if PASSDB_INTERFACE_VERSION < 19 -static bool mysqlsam_rid_algorithm (struct pdb_methods *pdb_methods) { - return true; -} -#else static uint32_t mysqlsam_capabilities (struct pdb_methods *pdb_methods) { return PDB_CAP_STORE_RIDS | PDB_CAP_ADS; } -#endif + static bool mysqlsam_new_rid (struct pdb_methods *pdb_methods, uint32 *rid) { return false; } @@ -545,11 +540,7 @@ (*pdb_method)->add_sam_account = mysqlsam_add_sam_account; (*pdb_method)->update_sam_account = mysqlsam_update_sam_account; (*pdb_method)->delete_sam_account = mysqlsam_delete_sam_account; -#if PASSDB_INTERFACE_VERSION < 19 - (*pdb_method)->rid_algorithm = mysqlsam_rid_algorithm; -#else (*pdb_method)->capabilities = mysqlsam_capabilities; -#endif (*pdb_method)->new_rid = mysqlsam_new_rid; data = talloc(*pdb_method, struct pdb_mysql_data); Modified: branches/pdbsql_36/pdb_pgsql.c =================================================================== --- branches/pdbsql_36/pdb_pgsql.c 2013-05-10 21:20:29 UTC (rev 178) +++ branches/pdbsql_36/pdb_pgsql.c 2013-05-11 07:28:13 UTC (rev 179) @@ -444,17 +444,10 @@ return pgsqlsam_replace_sam_account(methods, newpwd, 1); } -#if PASSDB_INTERFACE_VERSION < 19 -static bool pgsqlsam_rid_algorithm(struct pdb_methods *pdb_methods) -{ - return true; -} -#else static uint32_t pgsqlsam_capabilities(struct pdb_methods *pdb_methods) { return PDB_CAP_ADS; } -#endif /* Iterate through search results, if a new entry is available: store in * entry and return true. Otherwise: return false @@ -598,11 +591,7 @@ (*pdb_method)->add_sam_account = pgsqlsam_add_sam_account; (*pdb_method)->update_sam_account = pgsqlsam_update_sam_account; (*pdb_method)->delete_sam_account = pgsqlsam_delete_sam_account; -#if PASSDB_INTERFACE_VERSION < 19 - (*pdb_method)->rid_algorithm = pgsqlsam_rid_algorithm; -#else (*pdb_method)->capabilities = pgsqlsam_capabilities; -#endif data = talloc(*pdb_method, struct pdb_pgsql_data); (*pdb_method)->private_data = data; Modified: branches/pdbsql_36/pdb_sql.c =================================================================== --- branches/pdbsql_36/pdb_sql.c 2013-05-10 21:20:29 UTC (rev 178) +++ branches/pdbsql_36/pdb_sql.c 2013-05-11 07:28:13 UTC (rev 179) @@ -556,11 +556,7 @@ pwhist = pdb_get_pw_history(newpwd, &pw_history_len); -#if PASSDB_INTERFACE_VERSION < 19 - pdb_get_account_policy(AP_PASSWORD_HISTORY, &max_history_len); -#else pdb_get_account_policy(PDB_POLICY_PASSWORD_HISTORY, &pw_history_len); -#endif some_field_affected = 1; for (i = 0; i < max_history_len && i < pw_history_len; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-05-10 21:20:32
|
Revision: 178 http://sourceforge.net/p/pdbsql/code/178 Author: herwinw Date: 2013-05-10 21:20:29 +0000 (Fri, 10 May 2013) Log Message: ----------- Make it possible to add users in pdb_pgsql * Removed the PDB_CAP_STORE_RIDS capability, since we aren't interested in generating them ourselves. (This should probably happen to pdb_mysql too, but haven't had the time to test that) * See PGRES_COMMAND_OK as a valid return value from libpq which means our query has succeeded * Removed update of login_hours column. It failed using postgres (something about encoding) Modified Paths: -------------- branches/pdbsql_36/pdb_pgsql.c branches/pdbsql_36/pdb_sql.c Modified: branches/pdbsql_36/pdb_pgsql.c =================================================================== --- branches/pdbsql_36/pdb_pgsql.c 2013-05-10 19:27:13 UTC (rev 177) +++ branches/pdbsql_36/pdb_pgsql.c 2013-05-10 21:20:29 UTC (rev 178) @@ -145,10 +145,13 @@ /* Will happen mostly because the server has been disconnected */ DEBUG(1, ("Error executing %s, %s (trying to recover with reconnect)\n", query, PQerrorMessage(data->handle))); PQreset(data->handle); - } else if (PQresultStatus(result) != PGRES_TUPLES_OK) { - DEBUG(1, ("Error executing %s, %s\n", query, PQresultErrorMessage(result))); - PQclear(result); - result = NULL; + } else { + int status = PQresultStatus(result); + if (status != PGRES_TUPLES_OK && status != PGRES_COMMAND_OK) { + DEBUG(1, ("Error executing %s, %s\n", query, PQresultErrorMessage(result))); + PQclear(result); + result = NULL; + } } return result; @@ -449,13 +452,9 @@ #else static uint32_t pgsqlsam_capabilities(struct pdb_methods *pdb_methods) { - return PDB_CAP_STORE_RIDS | PDB_CAP_ADS; + return PDB_CAP_ADS; } #endif -static bool pgsqlsam_new_rid(struct pdb_methods *pdb_methods, uint32 *rid) -{ - return false; -} /* Iterate through search results, if a new entry is available: store in * entry and return true. Otherwise: return false @@ -604,7 +603,6 @@ #else (*pdb_method)->capabilities = pgsqlsam_capabilities; #endif - (*pdb_method)->new_rid = pgsqlsam_new_rid; data = talloc(*pdb_method, struct pdb_pgsql_data); (*pdb_method)->private_data = data; Modified: branches/pdbsql_36/pdb_sql.c =================================================================== --- branches/pdbsql_36/pdb_sql.c 2013-05-10 19:27:13 UTC (rev 177) +++ branches/pdbsql_36/pdb_sql.c 2013-05-10 21:20:29 UTC (rev 178) @@ -536,6 +536,8 @@ CONFIG_NT_PW_DEFAULT), temp); } +/* FIXME This currently gives an error about encoding in postgres. Fix it */ +#if 0 if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_HOURS)) { some_field_affected = 1; pdb_sql_string_field(query, @@ -544,6 +546,7 @@ CONFIG_LOGON_HOURS_DEFAULT), (const char *)pdb_get_hours(newpwd)); } +#endif if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_PWHISTORY)) { uint32 pw_history_len = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-05-10 19:27:17
|
Revision: 177 http://sourceforge.net/p/pdbsql/code/177 Author: herwinw Date: 2013-05-10 19:27:13 +0000 (Fri, 10 May 2013) Log Message: ----------- Lot of whitespace fixes * Removed trailing whitespace (which will be great if we ever want to import the project into git) * Uniformized on tabs instead of a mix of tabs and spaces * Some reindenting (mainly just a gg=G in vim) Modified Paths: -------------- branches/pdbsql_36/pdb_multi.c branches/pdbsql_36/pdb_mysql.c branches/pdbsql_36/pdb_pgsql.c branches/pdbsql_36/pdb_sql.c branches/pdbsql_36/pdb_sql.h Modified: branches/pdbsql_36/pdb_multi.c =================================================================== --- branches/pdbsql_36/pdb_multi.c 2013-05-03 17:26:24 UTC (rev 176) +++ branches/pdbsql_36/pdb_multi.c 2013-05-10 19:27:13 UTC (rev 177) @@ -66,7 +66,7 @@ if (res == true) return true; } - + return false; } @@ -86,8 +86,8 @@ } static bool multisam_search_users(struct pdb_methods *methods, - struct pdb_search *search, - uint32 acct_flags) + struct pdb_search *search, + uint32 acct_flags) { struct multisam_search_state *state; struct multisam_data *data; @@ -136,16 +136,16 @@ static bool multisam_new_rid(struct pdb_methods *methods, uint32 *rid, - short backend) + short backend) { short i; struct multisam_data *data; - + if (!methods) return false; data = (struct multisam_data *)methods->private_data; if (!data) return false; - - + + /* 250 tries.. Andrew Bartlett picked the number. */ for (i = 0; *rid == 0 && i < 250; i++) { if (!data->methods[backend]->new_rid(data->methods[backend], rid)) { @@ -156,24 +156,24 @@ *rid = 0; } */ } - + if (*rid == 0) { return false; } - + return true; } #if 0 static bool multisam_search_groups(struct pdb_methods *methods, - struct pdb_search *search) + struct pdb_search *search) { return false; } static bool multisam_search_aliases(struct pdb_methods *methods, - struct pdb_search *search, - const struct dom_sid *sid) + struct pdb_search *search, + const struct dom_sid *sid) { return false; } @@ -200,76 +200,76 @@ #if PASSDB_INTERFACE_VERSION < 19 /* Tries uid_to_rid on every backend until one succeeds, returns true on success */ static bool multisam_uid_to_rid(struct pdb_methods *methods, uid_t uid, - uint32 *rid) + uint32 *rid) { short i; struct multisam_data *data; bool rv; - + if (!methods) return false; data = (struct multisam_data *)methods->private_data; if (!data) return false; - + for (i = 0; i < data->num_backends; i++) { rv = data->methods[i]->uid_to_rid(data->methods[i], uid, rid); if (rv == true) { return true; } } - + return false; } #endif /* Tries gid_to_sid on every backend until one succeeds, returns true on success */ static bool multisam_gid_to_sid(struct pdb_methods *methods, gid_t gid, - struct dom_sid *sid) + struct dom_sid *sid) { short i; struct multisam_data *data; bool rv; - + if (!methods) return false; data = (struct multisam_data *)methods->private_data; if (!data) return false; - + for (i = 0; i < data->num_backends; i++) { rv = data->methods[i]->gid_to_sid(data->methods[i], gid, sid); if (rv == true) { return true; } } - + return false; } /* Tries sid_to_id on every backend until one succeeds, returns true on success */ static bool multisam_sid_to_id(struct pdb_methods *methods, - const struct dom_sid *sid, - union unid_t *id, enum lsa_SidType *type) + const struct dom_sid *sid, + union unid_t *id, enum lsa_SidType *type) { short i; struct multisam_data *data; bool rv; - + if (!methods) return false; data = (struct multisam_data *)methods->private_data; if (!data) return false; - + for (i = 0; i < data->num_backends; i++) { rv = data->methods[i]->sid_to_id(data->methods[i], sid, id, type); if (rv == true) { return true; } } - + return false; } #if 0 static NTSTATUS multisam_set_unix_primary_group(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, - struct samu *sampass) + TALLOC_CTX *mem_ctx, + struct samu *sampass) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -281,9 +281,9 @@ uint32 acb_info, uint32 *rid) { struct multisam_data *data; - + SET_DATA(data, methods); - + DEBUG(0, ("Creating user in first multisam backend\n")); /* XXX Might be nice to allow separations of machine accounts here? */ @@ -299,8 +299,8 @@ multisam_new_rid(methods, rid, 0); } #endif - - return data->methods[0]->create_user(data->methods[0], tmp_ctx, name, acb_info, rid); + + return data->methods[0]->create_user(data->methods[0], tmp_ctx, name, acb_info, rid); } static NTSTATUS multisam_delete_user(struct pdb_methods *methods, @@ -311,7 +311,7 @@ struct multisam_data *data; SET_DATA(data, methods); - + for (i = 0; i < data->num_backends; i++) { if (NT_STATUS_IS_OK(data->methods[i]->delete_user(data->methods[i], mem_ctx, sam_acct))) { return NT_STATUS_OK; @@ -323,11 +323,11 @@ #if 0 static NTSTATUS multisam_enum_group_memberships(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, - struct samu *user, - struct dom_sid **pp_sids, - gid_t **pp_gids, - size_t *p_num_groups) + TALLOC_CTX *mem_ctx, + struct samu *user, + struct dom_sid **pp_sids, + gid_t **pp_gids, + size_t *p_num_groups) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -346,8 +346,8 @@ static NTSTATUS multisam_delete_dom_group(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, - uint32 rid) + TALLOC_CTX *mem_ctx, + uint32 rid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -361,21 +361,21 @@ } static NTSTATUS multisam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map, - struct dom_sid sid) + struct dom_sid sid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_getgrgid(struct pdb_methods *methods, GROUP_MAP *map, - gid_t gid) + gid_t gid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_getgrnam(struct pdb_methods *methods, GROUP_MAP *map, - const char *name) + const char *name) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -396,12 +396,12 @@ return data->methods[i]->add_group_mapping_entry(data->methods[i], map); } } - + return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_update_group_mapping_entry(struct pdb_methods *methods, - GROUP_MAP *map) + GROUP_MAP *map) { short i; struct multisam_data *data; @@ -421,7 +421,7 @@ } static NTSTATUS multisam_delete_group_mapping_entry(struct pdb_methods *methods, - struct dom_sid sid) + struct dom_sid sid) { short i; struct multisam_data *data; @@ -442,9 +442,9 @@ #if 0 static NTSTATUS multisam_enum_group_mapping(struct pdb_methods *methods, - const struct dom_sid *sid, enum SID_NAME_USE sid_name_use, - GROUP_MAP **pp_rmap, size_t *p_num_entries, - bool unix_only) + const struct dom_sid *sid, enum SID_NAME_USE sid_name_use, + GROUP_MAP **pp_rmap, size_t *p_num_entries, + bool unix_only) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -458,64 +458,64 @@ } static NTSTATUS multisam_create_alias(struct pdb_methods *methods, - const char *name, uint32 *rid) + const char *name, uint32 *rid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_delete_alias(struct pdb_methods *methods, - const struct dom_sid *sid) + const struct dom_sid *sid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_get_aliasinfo(struct pdb_methods *methods, - const struct dom_sid *sid, - struct acct_info *info) + const struct dom_sid *sid, + struct acct_info *info) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_set_aliasinfo(struct pdb_methods *methods, - const struct dom_sid *sid, - struct acct_info *info) + const struct dom_sid *sid, + struct acct_info *info) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_add_aliasmem(struct pdb_methods *methods, - const struct dom_sid *alias, const struct dom_sid *member) + const struct dom_sid *alias, const struct dom_sid *member) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_del_aliasmem(struct pdb_methods *methods, - const struct dom_sid *alias, const struct dom_sid *member) + const struct dom_sid *alias, const struct dom_sid *member) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } NTSTATUS multisam_enum_aliasmem(struct pdb_methods *methods, - const struct dom_sid *alias, struct dom_sid **pp_members, - size_t *p_num_members) + const struct dom_sid *alias, struct dom_sid **pp_members, + size_t *p_num_members) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_alias_memberships(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, - const struct dom_sid *domain_sid, - const struct dom_sid *members, - size_t num_members, - uint32 **pp_alias_rids, - size_t *p_num_alias_rids) + TALLOC_CTX *mem_ctx, + const struct dom_sid *domain_sid, + const struct dom_sid *members, + size_t num_members, + uint32 **pp_alias_rids, + size_t *p_num_alias_rids) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -531,7 +531,7 @@ NTSTATUS ret; SET_DATA(data, methods); - + DEBUG(1, ("Setsampwent executing..\n")); for (i = 0; i < data->num_backends; i++) { @@ -540,7 +540,7 @@ return ret; } } - + return NT_STATUS_OK; } @@ -558,7 +558,7 @@ if (!data) return; DEBUG(1, ("Freeing pwent results on multisam backends\n")); - + for (i = 0; i < data->num_backends; i++) { data->methods[i]->endsampwent(data->methods[i]); } @@ -573,16 +573,16 @@ short i; struct multisam_data *data; NTSTATUS ret; - + SET_DATA(data, methods); - + for (i = 0; i < data->num_backends; i++) { ret = data->methods[i]->getsampwent(data->methods[i], user); if (NT_STATUS_IS_OK(ret)) { return ret; } } - + return NT_STATUS_INVALID_PARAMETER; } #endif @@ -592,14 +592,14 @@ ******************************************************************/ /* Tries to find the account in all backends until it succeeds or runs out of backends */ static NTSTATUS multisam_getsampwnam(struct pdb_methods *methods, struct samu * user, - const char *sname) + const char *sname) { short i; struct multisam_data *data; NTSTATUS ret; SET_DATA(data, methods); - + for (i = 0; i < data->num_backends; i++) { DEBUG(5, ("Looking for user in %s\n", data->names[i])); if (NT_STATUS_IS_OK(ret = data->methods[i]->getsampwnam(data->methods[i], user, sname))) { @@ -616,14 +616,14 @@ **************************************************************************/ /* Tries to find the account in all backends until it succeeds or runs out of backends */ static NTSTATUS multisam_getsampwsid(struct pdb_methods *methods, struct samu * user, - const struct dom_sid * sid) + const struct dom_sid * sid) { short i; struct multisam_data *data; NTSTATUS ret; SET_DATA(data, methods); - + for (i = 0; i < data->num_backends; i++) { DEBUG(5, ("Looking for user in %s\n", data->names[i])); if (NT_STATUS_IS_OK(ret = data->methods[i]->getsampwsid(data->methods[i], user, sid))) { @@ -635,9 +635,9 @@ } /*************************************************************************** - Delete a sam account + Delete a sam account ****************************************************************************/ -/* Tries to delete the user from all backends, if one succeeds we're happy */ +/* Tries to delete the user from all backends, if one succeeds we're happy */ static NTSTATUS multisam_delete_sam_account(struct pdb_methods *methods, struct samu * sam_pass) { @@ -645,7 +645,7 @@ struct multisam_data *data; SET_DATA(data, methods); - + for (i = 0; i < data->num_backends; i++) { if (NT_STATUS_IS_OK(data->methods[i]->delete_sam_account(data->methods[i], sam_pass))) { return NT_STATUS_OK; @@ -659,9 +659,9 @@ static NTSTATUS multisam_add_sam_account(struct pdb_methods *methods, struct samu * newpwd) { struct multisam_data *data; - + SET_DATA(data, methods); - + DEBUG(0, ("Creating sam account in first multisam backend\n")); return data->methods[0]->add_sam_account(data->methods[0], newpwd); } @@ -673,7 +673,7 @@ short i; struct multisam_data *data; NTSTATUS ret; - + SET_DATA(data, methods); DEBUG(5, ("Updating sam account.\n")); for (i = 0; i < data->num_backends; i++) { @@ -689,7 +689,7 @@ short i; struct multisam_data *data; NTSTATUS ret; - + SET_DATA(data, methods); DEBUG(5, ("Renaming sam account.\n")); for (i = 0; i < data->num_backends; i++) { @@ -704,37 +704,37 @@ #if 0 static NTSTATUS multisam_lookup_rids(struct pdb_methods *methods, - const struct dom_sid *domain_sid, - int num_rids, - uint32 *rids, - const char **names, - uint32 *attrs) + const struct dom_sid *domain_sid, + int num_rids, + uint32 *rids, + const char **names, + uint32 *attrs) { return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_create_dom_group(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, - const char *name, - uint32 *rid) + TALLOC_CTX *mem_ctx, + const char *name, + uint32 *rid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_add_groupmem(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, - uint32 group_rid, - uint32 member_rid) + TALLOC_CTX *mem_ctx, + uint32 group_rid, + uint32 member_rid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_del_groupmem(struct pdb_methods *methods, - TALLOC_CTX *mem_ctx, - uint32 group_rid, - uint32 member_rid) + TALLOC_CTX *mem_ctx, + uint32 group_rid, + uint32 member_rid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -771,7 +771,7 @@ if (multisam_debug_level == -1) { multisam_debug_level = DBGC_ALL; DEBUG(0, - ("multisam: Couldn't register custom debugging class!\n")); + ("multisam: Couldn't register custom debugging class!\n")); } if ( !NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method )) ) { @@ -786,7 +786,7 @@ DEBUG(0, ("Could not create default pdb_method\n")); return nt_status; } - + (*pdb_method)->name = "multisam"; /* Mandatory implementation */ @@ -814,8 +814,8 @@ #endif (*pdb_method)->gid_to_sid = multisam_gid_to_sid; (*pdb_method)->sid_to_id = multisam_sid_to_id; - + /* Not yet implemented here */ #if 0 (*pdb_method)->update_login_attempts = multisam_update_login_attempts; @@ -879,10 +879,10 @@ DEBUG(0, ("Unable to find multisam backend %d: %s\n", i, data->names[i])); return NT_STATUS_UNSUCCESSFUL; } - + DEBUG(2, ("Found entry point. Loading multisam backend %d: %s\n", i, data->names[i])); nt_status = entry->init(&data->methods[i], data->locations[i]); - + if (NT_STATUS_IS_ERR(nt_status)) { return nt_status; } @@ -893,11 +893,11 @@ (*pdb_method)->update_group_mapping_entry = multisam_update_group_mapping_entry; if (!IS_DEFAULT(data->methods[i], delete_group_mapping_entry)) (*pdb_method)->delete_group_mapping_entry = multisam_delete_group_mapping_entry; - } + } return NT_STATUS_OK; } -NTSTATUS init_samba_module(void) +NTSTATUS init_samba_module(void) { return smb_register_passdb(PASSDB_INTERFACE_VERSION, "multi", multisam_init); } Modified: branches/pdbsql_36/pdb_mysql.c =================================================================== --- branches/pdbsql_36/pdb_mysql.c 2013-05-03 17:26:24 UTC (rev 176) +++ branches/pdbsql_36/pdb_mysql.c 2013-05-10 19:27:13 UTC (rev 177) @@ -31,11 +31,11 @@ #include <mysql.h> #include <errmsg.h> -#define CONFIG_HOST_DEFAULT "localhost" -#define CONFIG_USER_DEFAULT "samba" -#define CONFIG_PASS_DEFAULT "" -#define CONFIG_PORT_DEFAULT "3306" -#define CONFIG_DB_DEFAULT "samba" +#define CONFIG_HOST_DEFAULT "localhost" +#define CONFIG_USER_DEFAULT "samba" +#define CONFIG_PASS_DEFAULT "" +#define CONFIG_PORT_DEFAULT "3306" +#define CONFIG_DB_DEFAULT "samba" static int mysqlsam_debug_level = DBGC_ALL; @@ -51,17 +51,17 @@ #define SET_DATA(data,methods) { \ if(!methods){ \ DEBUG(0, ("invalid methods!\n")); \ - return NT_STATUS_INVALID_PARAMETER; \ + return NT_STATUS_INVALID_PARAMETER; \ } \ data = (struct pdb_mysql_data *)methods->private_data; \ if(!data || !(data->handle)){ \ DEBUG(0, ("invalid handle!\n")); \ - return NT_STATUS_INVALID_HANDLE; \ + return NT_STATUS_INVALID_HANDLE; \ } \ } #define config_value( data, name, default_value ) \ - lp_parm_const_string( GLOBAL_SECTION_SNUM, (data)->location, name, default_value ) + lp_parm_const_string( GLOBAL_SECTION_SNUM, (data)->location, name, default_value ) static long xatol(const char *d) { @@ -76,16 +76,16 @@ config_value(data, "mysql user", CONFIG_USER_DEFAULT), config_value(data, "mysql password", CONFIG_PASS_DEFAULT), config_value(data, "mysql database", CONFIG_DB_DEFAULT), - xatol(config_value (data, "mysql port", CONFIG_PORT_DEFAULT)), + xatol(config_value (data, "mysql port", CONFIG_PORT_DEFAULT)), NULL, 0)) { DEBUG(0, - ("Failed to connect to mysql database: error: %s\n", - mysql_error(data->handle))); + ("Failed to connect to mysql database: error: %s\n", + mysql_error(data->handle))); return NT_STATUS_UNSUCCESSFUL; } - + DEBUG(5, ("Connected to mysql db\n")); - + return NT_STATUS_OK; } @@ -95,7 +95,7 @@ DEBUG(5, ("Executing query %s\n", query)); res = mysql_query(data->handle, query); - + /* [SYN] If the server has gone away, reconnect and retry */ if (res && mysql_errno(data->handle) == CR_SERVER_GONE_ERROR) { DEBUG(5, ("MySQL server has gone away, reconnecting and retrying.\n")); @@ -112,7 +112,7 @@ if (res) { DEBUG(0, - ("Error while executing MySQL query %s\n", + ("Error while executing MySQL query %s\n", mysql_error(data->handle))); } @@ -179,15 +179,15 @@ pdb_set_logon_count(u, xatol(row[27]), PDB_SET); pdb_set_unknown_6(u, xatol(row[28]), PDB_SET); pdb_set_hours(u, (uint8 *)row[29], xatol(row[25]), PDB_SET); - + if (row[30]) { uint8 pwhist[MAX_PW_HISTORY_LEN * PW_HISTORY_ENTRY_LEN]; int i; - + memset(&pwhist, 0, MAX_PW_HISTORY_LEN * PW_HISTORY_ENTRY_LEN); for (i = 0; i < MAX_PW_HISTORY_LEN && i < strlen(row[30])/64; i++) { pdb_gethexpwd(&(row[30])[i*64], &pwhist[i*PW_HISTORY_ENTRY_LEN]); - pdb_gethexpwd(&(row[30])[i*64+32], + pdb_gethexpwd(&(row[30])[i*64+32], &pwhist[i*PW_HISTORY_ENTRY_LEN+PW_HISTORY_SALT_LEN]); } pdb_set_pw_history(u, pwhist, strlen(row[30])/64, PDB_SET); @@ -197,7 +197,7 @@ } static NTSTATUS mysqlsam_select_by_field(struct pdb_methods * methods, struct samu * user, - enum sql_search_field field, const char *sname) + enum sql_search_field field, const char *sname) { char *esc_sname; char *query; @@ -213,14 +213,14 @@ esc_sname = talloc_array(mem_ctx, char, strlen(sname) * 2 + 1); if (!esc_sname) { talloc_free(mem_ctx); - return NT_STATUS_NO_MEMORY; + return NT_STATUS_NO_MEMORY; } tmp_sname = talloc_strdup(mem_ctx, sname); - + /* Escape sname */ mysql_real_escape_string(data->handle, esc_sname, tmp_sname, - strlen(tmp_sname)); + strlen(tmp_sname)); talloc_free(tmp_sname); @@ -240,7 +240,7 @@ talloc_free(mem_ctx); return NT_STATUS_UNSUCCESSFUL; } - + talloc_free(query); res = mysql_store_result(data->handle); if (res == NULL) { @@ -249,7 +249,7 @@ talloc_free(mem_ctx); return NT_STATUS_UNSUCCESSFUL; } - + ret = row_to_sam_account(res, user); mysql_free_result(res); talloc_free(mem_ctx); @@ -262,7 +262,7 @@ ******************************************************************/ static NTSTATUS mysqlsam_getsampwnam(struct pdb_methods *methods, struct samu * user, - const char *sname) + const char *sname) { struct pdb_mysql_data *data; @@ -283,7 +283,7 @@ **************************************************************************/ static NTSTATUS mysqlsam_getsampwsid(struct pdb_methods *methods, struct samu * user, - const struct dom_sid * sid) + const struct dom_sid * sid) { struct pdb_mysql_data *data; fstring sid_str; @@ -292,12 +292,12 @@ sid_to_fstring(sid_str, sid); /* sid_string_dbg(sid); */ - + return mysqlsam_select_by_field(methods, user, SQL_SEARCH_USER_SID, sid_str); } /*************************************************************************** - Delete a sam account + Delete a sam account ****************************************************************************/ static NTSTATUS mysqlsam_delete_sam_account(struct pdb_methods *methods, @@ -329,18 +329,18 @@ } mem_ctx = talloc_init("mysqlsam_delete_sam_account"); - + /* Escape sname */ esc = talloc_array(mem_ctx, char, strlen(sname) * 2 + 1); if (!esc) { DEBUG(0, ("Can't allocate memory to store escaped name\n")); return NT_STATUS_NO_MEMORY; } - + tmp_sname = talloc_strdup(mem_ctx, sname); - + mysql_real_escape_string(data->handle, esc, tmp_sname, - strlen(tmp_sname)); + strlen(tmp_sname)); talloc_free(tmp_sname); @@ -363,7 +363,7 @@ } static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods, - struct samu * newpwd, char isupdate) + struct samu * newpwd, char isupdate) { struct pdb_mysql_data *data; char *query; @@ -384,8 +384,8 @@ query = sql_account_query_update(NULL, data->location, newpwd, isupdate); if ( query == NULL ) /* Nothing to update. */ return NT_STATUS_OK; - - + + if (pdb_mysql_query(data, query, &mysql_ret) == false) { talloc_free(query); @@ -451,7 +451,7 @@ entry->account_name = talloc_strdup(search, row[6]); entry->fullname = talloc_strdup(search, row[9]); entry->description = talloc_strdup(search, row[14]); - + state->current += 1; if ((entry->account_name == NULL)) { @@ -533,10 +533,10 @@ DEBUG(0,("mysqlsam: Couldn't register custom debugging class!\n")); } - if (!NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method ))) { + if (!NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method ))) { return nt_status; - } - + } + (*pdb_method)->name = "mysqlsam"; (*pdb_method)->search_users = mysqlsam_search_users; @@ -565,11 +565,11 @@ data->location = talloc_strdup(data, location); DEBUG(1, - ("Connecting to database server, host: %s, user: %s, database: %s, port: %ld\n", - config_value(data, "mysql host", CONFIG_HOST_DEFAULT), - config_value(data, "mysql user", CONFIG_USER_DEFAULT), - config_value(data, "mysql database", CONFIG_DB_DEFAULT), - xatol(config_value(data, "mysql port", CONFIG_PORT_DEFAULT)))); + ("Connecting to database server, host: %s, user: %s, database: %s, port: %ld\n", + config_value(data, "mysql host", CONFIG_HOST_DEFAULT), + config_value(data, "mysql user", CONFIG_USER_DEFAULT), + config_value(data, "mysql database", CONFIG_DB_DEFAULT), + xatol(config_value(data, "mysql port", CONFIG_PORT_DEFAULT)))); /* Do the mysql initialization */ data->handle = mysql_init(NULL); @@ -581,7 +581,7 @@ if(!sql_account_config_valid(data->location)) { return NT_STATUS_INVALID_PARAMETER; } - + if (!NT_STATUS_IS_OK(pdb_mysql_connect(data))) { return NT_STATUS_UNSUCCESSFUL; } @@ -589,7 +589,7 @@ return NT_STATUS_OK; } -NTSTATUS init_samba_module(void) +NTSTATUS init_samba_module(void) { return smb_register_passdb(PASSDB_INTERFACE_VERSION, "mysql", mysqlsam_init); } Modified: branches/pdbsql_36/pdb_pgsql.c =================================================================== --- branches/pdbsql_36/pdb_pgsql.c 2013-05-03 17:26:24 UTC (rev 176) +++ branches/pdbsql_36/pdb_pgsql.c 2013-05-10 19:27:13 UTC (rev 177) @@ -39,11 +39,11 @@ #undef PACKAGE_TARNAME #include <pg_config.h> -#define CONFIG_HOST_DEFAULT "localhost" -#define CONFIG_USER_DEFAULT "samba" -#define CONFIG_PASS_DEFAULT "" -#define CONFIG_PORT_DEFAULT DEF_PGPORT_STR -#define CONFIG_DB_DEFAULT "samba" +#define CONFIG_HOST_DEFAULT "localhost" +#define CONFIG_USER_DEFAULT "samba" +#define CONFIG_PASS_DEFAULT "" +#define CONFIG_PORT_DEFAULT DEF_PGPORT_STR +#define CONFIG_DB_DEFAULT "samba" static int pgsqlsam_debug_level = DBGC_ALL; @@ -76,7 +76,7 @@ #define SET_DATA(data,methods) { \ if(!methods){ \ DEBUG(0, ("invalid methods!\n")); \ - return NT_STATUS_INVALID_PARAMETER; \ + return NT_STATUS_INVALID_PARAMETER; \ } \ data = (struct pdb_pgsql_data *)methods->private_data; \ } @@ -85,7 +85,7 @@ #define SET_DATA_QUIET(data,methods) { \ if(!methods){ \ DEBUG(0, ("invalid methods!\n")); \ - return; \ + return; \ } \ data = (struct pdb_pgsql_data *)methods->private_data; \ } @@ -97,10 +97,10 @@ static PGconn *pgsqlsam_connect(struct pdb_pgsql_data *data) { PGconn *handle; - + DEBUG(1, ("Connecting to database server, host: %s, user: %s, password: XXXXXX, database: %s, port: %s\n", - data->host, data->user, data->db, data->port)); - + data->host, data->user, data->db, data->port)); + /* Do the pgsql initialization */ handle = PQsetdbLogin( data->host, @@ -110,13 +110,13 @@ data->db, data->user, data->pass); - + if (handle != NULL && PQstatus(handle) != CONNECTION_OK) { DEBUG(0, ("Failed to connect to pgsql database: error: %s\n", (handle != NULL ? PQerrorMessage(handle) : ""))); return NULL; } - + DEBUG(5, ("Connected to pgsql database\n")); return handle; } @@ -159,7 +159,7 @@ if (PQgetisnull(r, row, col)) { return 0; } - + return atol(PQgetvalue(r, row, col)); } @@ -169,7 +169,7 @@ struct dom_sid sid; unsigned char *hours; size_t hours_len = 0; - + if (row >= PQntuples(r)) { return NT_STATUS_INVALID_PARAMETER; } @@ -192,14 +192,14 @@ pdb_set_workstations (u, PQgetvalue(r, row, 15), PDB_SET); pdb_set_comment (u, PQgetvalue(r, row, 16), PDB_SET); pdb_set_munged_dial (u, PQgetvalue(r, row, 17), PDB_SET); - + pdb_set_acct_ctrl (u, PQgetlong (r, row, 23), PDB_SET); pdb_set_logon_divs (u, PQgetlong (r, row, 24), PDB_SET); pdb_set_hours_len (u, PQgetlong (r, row, 25), PDB_SET); pdb_set_bad_password_count (u, PQgetlong (r, row, 26), PDB_SET); pdb_set_logon_count (u, PQgetlong (r, row, 27), PDB_SET); pdb_set_unknown_6 (u, PQgetlong (r, row, 28), PDB_SET); - + hours = (unsigned char *) PQgetvalue (r, row, 29); if (hours != NULL) { hours = PQunescapeBytea(hours, &hours_len); @@ -207,8 +207,8 @@ pdb_set_hours(u, hours, PQgetlong(r, row, 25), PDB_SET); } } - - + + if (!PQgetisnull(r, row, 18)) { string_to_sid(&sid, PQgetvalue(r, row, 18)); pdb_set_user_sid(u, &sid, PDB_SET); @@ -218,7 +218,7 @@ string_to_sid(&sid, PQgetvalue(r, row, 19)); pdb_set_group_sid(u, &sid, PDB_SET); } - + if (pdb_gethexpwd(PQgetvalue(r, row, 20), temp)) { pdb_set_lanman_passwd(u, temp, PDB_SET); } @@ -230,32 +230,32 @@ uint8 pwhist[MAX_PW_HISTORY_LEN * PW_HISTORY_ENTRY_LEN]; int i; char *history_string = PQgetvalue(r, row, 30); - + memset(&pwhist, 0, MAX_PW_HISTORY_LEN * PW_HISTORY_ENTRY_LEN); for (i = 0; i < MAX_PW_HISTORY_LEN && i < strlen(history_string)/64; i++) { pdb_gethexpwd(&(history_string)[i*64], &pwhist[i*PW_HISTORY_ENTRY_LEN]); - pdb_gethexpwd(&(history_string)[i*64+32], + pdb_gethexpwd(&(history_string)[i*64+32], &pwhist[i*PW_HISTORY_ENTRY_LEN+PW_HISTORY_SALT_LEN]); } pdb_set_pw_history(u, pwhist, strlen(history_string)/64, PDB_SET); } - + /* Only use plaintext password storage when lanman and nt are NOT used */ if (PQgetisnull(r, row, 20) || PQgetisnull(r, row, 21)) { pdb_set_plaintext_passwd(u, PQgetvalue(r, row, 22)); } - + return NT_STATUS_OK; } static NTSTATUS pgsqlsam_select_by_field(struct pdb_methods *methods, struct samu *user, enum sql_search_field field, const char *sname) { struct pdb_pgsql_data *data; - + char *esc; char *query; - + PGresult *result; NTSTATUS retval; @@ -265,22 +265,22 @@ DEBUG(0, ("pdb_getsampwnam: struct samu is NULL.\n")); return NT_STATUS_INVALID_PARAMETER; } - + DEBUG(5, ("pgsqlsam_select_by_field: getting data where %d = %s(nonescaped)\n", field, sname)); - + /* Escape sname */ esc = talloc_array(NULL, char, strlen(sname) * 2 + 1); if (!esc) { DEBUG(0, ("Can't allocate memory to store escaped name\n")); - return NT_STATUS_NO_MEMORY; + return NT_STATUS_NO_MEMORY; } - + /* tmp_sname = smb_xstrdup(sname); */ PQescapeString(esc, sname, strlen(sname)); query = sql_account_query_select(NULL, data->location, true, field, esc); result = pdb_pgsql_query(data, query); - + /* Result? */ if (result == NULL) { @@ -289,12 +289,12 @@ else { retval = row_to_sam_account(result, 0, user); - PQclear(result); + PQclear(result); } - + talloc_free(esc); talloc_free(query); - + return retval; } @@ -308,9 +308,9 @@ size_t i, l; char *lowercasename; NTSTATUS result; - + SET_DATA(data, methods); - + if (!sname) { DEBUG(0, ("invalid name specified")); return NT_STATUS_INVALID_PARAMETER; @@ -322,7 +322,7 @@ smb_ucs2_t uc = tolower_w(UCS2_CHAR(lowercasename[i])); lowercasename[i] = UCS2_TO_CHAR(uc); } - + result = pgsqlsam_select_by_field(methods, user, SQL_SEARCH_USER_NAME, lowercasename); talloc_free(lowercasename); @@ -338,9 +338,9 @@ static NTSTATUS pgsqlsam_getsampwsid(struct pdb_methods *methods, struct samu *user, const struct dom_sid *sid) { fstring sid_str; - + sid_to_fstring(sid_str, sid); - + return pgsqlsam_select_by_field(methods, user, SQL_SEARCH_USER_SID, sid_str); } @@ -351,33 +351,33 @@ static NTSTATUS pgsqlsam_delete_sam_account(struct pdb_methods *methods, struct samu *sam_pass) { struct pdb_pgsql_data *data; - + const char *sname = pdb_get_username(sam_pass); char *esc; char *query; - + PGresult *result; NTSTATUS retval; - + SET_DATA(data, methods); - + if (!sname) { DEBUG(0, ("invalid name specified\n")); return NT_STATUS_INVALID_PARAMETER; } - + /* Escape sname */ esc = talloc_array(NULL, char, strlen(sname) * 2 + 1); if (!esc) { DEBUG(0, ("Can't allocate memory to store escaped name\n")); return NT_STATUS_NO_MEMORY; } - + PQescapeString(esc, sname, strlen(sname)); query = sql_account_query_delete(NULL, data->location, esc); result = pdb_pgsql_query(data, query); - + if (result == NULL) { retval = NT_STATUS_UNSUCCESSFUL; } else { @@ -385,10 +385,10 @@ retval = NT_STATUS_OK; PQclear(result); } - + talloc_free(esc); talloc_free(query); - + return retval; } @@ -398,14 +398,14 @@ char *query; PGresult *result; NTSTATUS retval; - + if (!methods) { DEBUG(0, ("invalid methods!\n")); return NT_STATUS_INVALID_PARAMETER; } - + data = (struct pdb_pgsql_data *) methods->private_data; - + if (data == NULL) { DEBUG(0, ("invalid handle!\n")); return NT_STATUS_INVALID_HANDLE; @@ -419,14 +419,14 @@ /* Execute the query */ result = pdb_pgsql_query(data, query); - + if (result == NULL) { retval = NT_STATUS_INVALID_PARAMETER; } else { PQclear(result); retval = NT_STATUS_OK; } - + talloc_free(query); return retval; } @@ -442,17 +442,17 @@ } #if PASSDB_INTERFACE_VERSION < 19 -static bool pgsqlsam_rid_algorithm(struct pdb_methods *pdb_methods) +static bool pgsqlsam_rid_algorithm(struct pdb_methods *pdb_methods) { return true; } #else -static uint32_t pgsqlsam_capabilities(struct pdb_methods *pdb_methods) +static uint32_t pgsqlsam_capabilities(struct pdb_methods *pdb_methods) { return PDB_CAP_STORE_RIDS | PDB_CAP_ADS; } #endif -static bool pgsqlsam_new_rid(struct pdb_methods *pdb_methods, uint32 *rid) +static bool pgsqlsam_new_rid(struct pdb_methods *pdb_methods, uint32 *rid) { return false; } @@ -481,11 +481,11 @@ /* We've reached the end */ return false; } - + /* Now why do we need to fill entry as rid is enough? Okay, it is a bit * of a hack, but I don't see the point in filling everything when we * never read it. - */ + */ if (!PQgetisnull(r, row, 18)) { string_to_sid(&sid, PQgetvalue(r, row, 18)); entry->rid = sid.sub_auths[4]; @@ -505,7 +505,7 @@ if ((entry->acct_flags & search_state->acct_flags) != search_state->acct_flags) { return pgsqlsam_search_next_entry(search, entry); - + } return true; @@ -539,7 +539,7 @@ char *query; data = (struct pdb_pgsql_data *) pdb_methods->private_data; - + search_state = TALLOC_ZERO_P(search, struct pdb_pgsql_search_state); if (search_state == NULL) { DEBUG(0, ("talloc failed\n")); @@ -569,14 +569,14 @@ search->private_data = search_state; search->next_entry = pgsqlsam_search_next_entry; search->search_end = pgsqlsam_search_end; - + return true; } static NTSTATUS pgsqlsam_init (struct pdb_methods **pdb_method, const char *location) { NTSTATUS nt_status; - + struct pdb_pgsql_data *data; pgsqlsam_debug_level = debug_add_class("pgsqlsam"); @@ -586,13 +586,13 @@ ("pgsqlsam: Couldn't register custom debugging class!\n")); } - if ( !NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method )) ) { + if ( !NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method )) ) { return nt_status; - } - - + } + + (*pdb_method)->name = "pgsqlsam"; - + (*pdb_method)->search_users = pgsqlsam_search_users; (*pdb_method)->getsampwnam = pgsqlsam_getsampwnam; (*pdb_method)->getsampwsid = pgsqlsam_getsampwsid; Modified: branches/pdbsql_36/pdb_sql.c =================================================================== --- branches/pdbsql_36/pdb_sql.c 2013-05-03 17:26:24 UTC (rev 176) +++ branches/pdbsql_36/pdb_sql.c 2013-05-10 19:27:13 UTC (rev 177) @@ -2,17 +2,17 @@ * Common PDB SQL backend functions * Copyright (C) Jelmer Vernooij 2003-2004 * Copyright (C) Collen Blijenberg 2007-2008 - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. - * + * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 675 * Mass Ave, Cambridge, MA 02139, USA. @@ -23,38 +23,38 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB -#define CONFIG_TABLE_DEFAULT "user" -#define CONFIG_LOGON_TIME_DEFAULT "logon_time" -#define CONFIG_LOGOFF_TIME_DEFAULT "logoff_time" -#define CONFIG_KICKOFF_TIME_DEFAULT "kickoff_time" -#define CONFIG_PASS_LAST_SET_TIME_DEFAULT "pass_last_set_time" -#define CONFIG_PASS_CAN_CHANGE_TIME_DEFAULT "pass_can_change_time" -#define CONFIG_PASS_MUST_CHANGE_TIME_DEFAULT "pass_must_change_time" -#define CONFIG_USERNAME_DEFAULT "username" -#define CONFIG_DOMAIN_DEFAULT "domain" -#define CONFIG_NT_USERNAME_DEFAULT "nt_username" -#define CONFIG_FULLNAME_DEFAULT "nt_fullname" -#define CONFIG_HOME_DIR_DEFAULT "home_dir" -#define CONFIG_DIR_DRIVE_DEFAULT "dir_drive" -#define CONFIG_LOGON_SCRIPT_DEFAULT "logon_script" -#define CONFIG_PROFILE_PATH_DEFAULT "profile_path" -#define CONFIG_ACCT_DESC_DEFAULT "acct_desc" -#define CONFIG_WORKSTATIONS_DEFAULT "workstations" -#define CONFIG_UNKNOWN_STR_DEFAULT "unknown_str" -#define CONFIG_MUNGED_DIAL_DEFAULT "munged_dial" -#define CONFIG_USER_SID_DEFAULT "user_sid" -#define CONFIG_GROUP_SID_DEFAULT "group_sid" -#define CONFIG_LM_PW_DEFAULT "lm_pw" -#define CONFIG_NT_PW_DEFAULT "nt_pw" -#define CONFIG_PLAIN_PW_DEFAULT "NULL" -#define CONFIG_ACCT_CTRL_DEFAULT "acct_ctrl" -#define CONFIG_LOGON_DIVS_DEFAULT "logon_divs" -#define CONFIG_HOURS_LEN_DEFAULT "hours_len" -#define CONFIG_BAD_PASSWORD_COUNT_DEFAULT "bad_password_count" -#define CONFIG_LOGON_COUNT_DEFAULT "logon_count" -#define CONFIG_UNKNOWN_6_DEFAULT "unknown_6" -#define CONFIG_LOGON_HOURS_DEFAULT "logon_hours" -#define CONFIG_PASSWORD_HISTORY_DEFAULT "password_history" +#define CONFIG_TABLE_DEFAULT "user" +#define CONFIG_LOGON_TIME_DEFAULT "logon_time" +#define CONFIG_LOGOFF_TIME_DEFAULT "logoff_time" +#define CONFIG_KICKOFF_TIME_DEFAULT "kickoff_time" +#define CONFIG_PASS_LAST_SET_TIME_DEFAULT "pass_last_set_time" +#define CONFIG_PASS_CAN_CHANGE_TIME_DEFAULT "pass_can_change_time" +#define CONFIG_PASS_MUST_CHANGE_TIME_DEFAULT "pass_must_change_time" +#define CONFIG_USERNAME_DEFAULT "username" +#define CONFIG_DOMAIN_DEFAULT "domain" +#define CONFIG_NT_USERNAME_DEFAULT "nt_username" +#define CONFIG_FULLNAME_DEFAULT "nt_fullname" +#define CONFIG_HOME_DIR_DEFAULT "home_dir" +#define CONFIG_DIR_DRIVE_DEFAULT "dir_drive" +#define CONFIG_LOGON_SCRIPT_DEFAULT "logon_script" +#define CONFIG_PROFILE_PATH_DEFAULT "profile_path" +#define CONFIG_ACCT_DESC_DEFAULT "acct_desc" +#define CONFIG_WORKSTATIONS_DEFAULT "workstations" +#define CONFIG_UNKNOWN_STR_DEFAULT "unknown_str" +#define CONFIG_MUNGED_DIAL_DEFAULT "munged_dial" +#define CONFIG_USER_SID_DEFAULT "user_sid" +#define CONFIG_GROUP_SID_DEFAULT "group_sid" +#define CONFIG_LM_PW_DEFAULT "lm_pw" +#define CONFIG_NT_PW_DEFAULT "nt_pw" +#define CONFIG_PLAIN_PW_DEFAULT "NULL" +#define CONFIG_ACCT_CTRL_DEFAULT "acct_ctrl" +#define CONFIG_LOGON_DIVS_DEFAULT "logon_divs" +#define CONFIG_HOURS_LEN_DEFAULT "hours_len" +#define CONFIG_BAD_PASSWORD_COUNT_DEFAULT "bad_password_count" +#define CONFIG_LOGON_COUNT_DEFAULT "logon_count" +#define CONFIG_UNKNOWN_6_DEFAULT "unknown_6" +#define CONFIG_LOGON_HOURS_DEFAULT "logon_hours" +#define CONFIG_PASSWORD_HISTORY_DEFAULT "password_history" /* Used to construct insert and update queries */ @@ -72,7 +72,7 @@ if (q->update) { q->part1 = talloc_asprintf_append(q->part1, - "%s = %ld,", name, value); + "%s = %ld,", name, value); } else { q->part1 = talloc_asprintf_append(q->part1, "%s,", name); @@ -99,12 +99,12 @@ } esc[pos_esc] = '\0'; - + return esc; } static NTSTATUS pdb_sql_string_field(struct pdb_sql_query *q, - const char *name, const char *value) + const char *name, const char *value) { char *esc_value; @@ -116,13 +116,13 @@ if (q->update) { q->part1 = talloc_asprintf_append(q->part1, - "%s = '%s',", name, esc_value); + "%s = '%s',", name, esc_value); } else { q->part1 = talloc_asprintf_append(q->part1, "%s,", name); q->part2 = talloc_asprintf_append(q->part2, "'%s',", - esc_value); + esc_value); } talloc_free(esc_value); @@ -133,7 +133,7 @@ #define config_value(data,name,default_value) \ lp_parm_const_string(GLOBAL_SECTION_SNUM, data, name, default_value) -static const char * config_value_write(const char *location, const char *name, const char *default_value) +static const char * config_value_write(const char *location, const char *name, const char *default_value) { char const *v = NULL; char const *swrite = NULL; @@ -149,7 +149,7 @@ if (!swrite) { /* Updating NULL does not make much sense */ - if (!strcmp(v, "NULL")) + if (!strcmp(v, "NULL")) return NULL; return v; @@ -198,19 +198,19 @@ char *query; switch(field) { - case SQL_SEARCH_NONE: - field_string = "'1'"; - value = "1"; + case SQL_SEARCH_NONE: + field_string = "'1'"; + value = "1"; break; - - case SQL_SEARCH_USER_SID: - field_string = config_value_read(data, "user sid column", - CONFIG_USER_SID_DEFAULT); + + case SQL_SEARCH_USER_SID: + field_string = config_value_read(data, "user sid column", + CONFIG_USER_SID_DEFAULT); break; - - case SQL_SEARCH_USER_NAME: - field_string = config_value_read(data, "username column", - CONFIG_USERNAME_DEFAULT); + + case SQL_SEARCH_USER_NAME: + field_string = config_value_read(data, "username column", + CONFIG_USERNAME_DEFAULT); break; default: field_string = "unknown"; @@ -218,83 +218,83 @@ } query = talloc_asprintf(mem_ctx, - "SELECT %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s FROM %s WHERE %s = '%s'", - config_value_read(data, "logon time column", - CONFIG_LOGON_TIME_DEFAULT), - config_value_read(data, "logoff time column", - CONFIG_LOGOFF_TIME_DEFAULT), - config_value_read(data, "kickoff time column", - CONFIG_KICKOFF_TIME_DEFAULT), - config_value_read(data, "pass last set time column", - CONFIG_PASS_LAST_SET_TIME_DEFAULT), - config_value_read(data, "pass can change time column", - CONFIG_PASS_CAN_CHANGE_TIME_DEFAULT), - config_value_read(data, "pass must change time column", - CONFIG_PASS_MUST_CHANGE_TIME_DEFAULT), - config_value_read(data, "username column", - CONFIG_USERNAME_DEFAULT), - config_value_read(data, "domain column", - CONFIG_DOMAIN_DEFAULT), - config_value_read(data, "nt username column", - CONFIG_NT_USERNAME_DEFAULT), - config_value_read(data, "fullname column", - CONFIG_FULLNAME_DEFAULT), - config_value_read(data, "home dir column", - CONFIG_HOME_DIR_DEFAULT), - config_value_read(data, "dir drive column", - CONFIG_DIR_DRIVE_DEFAULT), - config_value_read(data, "logon script column", - CONFIG_LOGON_SCRIPT_DEFAULT), - config_value_read(data, "profile path column", - CONFIG_PROFILE_PATH_DEFAULT), - config_value_read(data, "acct desc column", - CONFIG_ACCT_DESC_DEFAULT), - config_value_read(data, "workstations column", - CONFIG_WORKSTATIONS_DEFAULT), - config_value_read(data, "unknown string column", - CONFIG_UNKNOWN_STR_DEFAULT), - config_value_read(data, "munged dial column", - CONFIG_MUNGED_DIAL_DEFAULT), - config_value_read(data, "user sid column", - CONFIG_USER_SID_DEFAULT), - config_value_read(data, "group sid column", - CONFIG_GROUP_SID_DEFAULT), - config_value_read(data, "lanman pass column", - CONFIG_LM_PW_DEFAULT), - config_value_read(data, "nt pass column", - CONFIG_NT_PW_DEFAULT), - config_value_read(data, "plain pass column", - CONFIG_PLAIN_PW_DEFAULT), - config_value_read(data, "acct ctrl column", - CONFIG_ACCT_CTRL_DEFAULT), - config_value_read(data, "logon divs column", - CONFIG_LOGON_DIVS_DEFAULT), - config_value_read(data, "hours len column", - CONFIG_HOURS_LEN_DEFAULT), - config_value_read(data, "bad password count column", - CONFIG_BAD_PASSWORD_COUNT_DEFAULT), - config_value_read(data, "logon count column", - CONFIG_LOGON_COUNT_DEFAULT), - config_value_read(data, "unknown 6 column", - CONFIG_UNKNOWN_6_DEFAULT), - config_value_read(data, "logon hours column", - CONFIG_LOGON_HOURS_DEFAULT), - config_value_read(data, "password history column", - CONFIG_PASSWORD_HISTORY_DEFAULT), - config_value(data, "table", CONFIG_TABLE_DEFAULT), - field_string, value - ); - return (char *)query; + "SELECT %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s FROM %s WHERE %s = '%s'", + config_value_read(data, "logon time column", + CONFIG_LOGON_TIME_DEFAULT), + config_value_read(data, "logoff time column", + CONFIG_LOGOFF_TIME_DEFAULT), + config_value_read(data, "kickoff time column", + CONFIG_KICKOFF_TIME_DEFAULT), + config_value_read(data, "pass last set time column", + CONFIG_PASS_LAST_SET_TIME_DEFAULT), + config_value_read(data, "pass can change time column", + CONFIG_PASS_CAN_CHANGE_TIME_DEFAULT), + config_value_read(data, "pass must change time column", + CONFIG_PASS_MUST_CHANGE_TIME_DEFAULT), + config_value_read(data, "username column", + CONFIG_USERNAME_DEFAULT), + config_value_read(data, "domain column", + CONFIG_DOMAIN_DEFAULT), + config_value_read(data, "nt username column", + CONFIG_NT_USERNAME_DEFAULT), + config_value_read(data, "fullname column", + CONFIG_FULLNAME_DEFAULT), + config_value_read(data, "home dir column", + CONFIG_HOME_DIR_DEFAULT), + config_value_read(data, "dir drive column", + CONFIG_DIR_DRIVE_DEFAULT), + config_value_read(data, "logon script column", + CONFIG_LOGON_SCRIPT_DEFAULT), + config_value_read(data, "profile path column", + CONFIG_PROFILE_PATH_DEFAULT), + config_value_read(data, "acct desc column", + CONFIG_ACCT_DESC_DEFAULT), + config_value_read(data, "workstations column", + CONFIG_WORKSTATIONS_DEFAULT), + config_value_read(data, "unknown string column", + CONFIG_UNKNOWN_STR_DEFAULT), + config_value_read(data, "munged dial column", + CONFIG_MUNGED_DIAL_DEFAULT), + config_value_read(data, "user sid column", + CONFIG_USER_SID_DEFAULT), + config_value_read(data, "group sid column", + CONFIG_GROUP_SID_DEFAULT), + config_value_read(data, "lanman pass column", + CONFIG_LM_PW_DEFAULT), + config_value_read(data, "nt pass column", + CONFIG_NT_PW_DEFAULT), + config_value_read(data, "plain pass column", + CONFIG_PLAIN_PW_DEFAULT), + config_value_read(data, "acct ctrl column", + CONFIG_ACCT_CTRL_DEFAULT), + config_value_read(data, "logon divs column", + CONFIG_LOGON_DIVS_DEFAULT), + config_value_read(data, "hours len column", + CONFIG_HOURS_LEN_DEFAULT), + config_value_read(data, "bad password count column", + CONFIG_BAD_PASSWORD_COUNT_DEFAULT), + config_value_read(data, "logon count column", + CONFIG_LOGON_COUNT_DEFAULT), + config_value_read(data, "unknown 6 column", + CONFIG_UNKNOWN_6_DEFAULT), + config_value_read(data, "logon hours column", + CONFIG_LOGON_HOURS_DEFAULT), + config_value_read(data, "password history column", + CONFIG_PASSWORD_HISTORY_DEFAULT), + config_value(data, "table", CONFIG_TABLE_DEFAULT), + field_string, value + ); + return (char *)query; } -char *sql_account_query_delete(TALLOC_CTX *mem_ctx, const char *data, const char *esc) +char *sql_account_query_delete(TALLOC_CTX *mem_ctx, const char *data, const char *esc) { char *query; - + query = talloc_asprintf(mem_ctx, "DELETE FROM %s WHERE %s = '%s'", - config_value(data, "table", CONFIG_TABLE_DEFAULT), - config_value_read(data, "username column", - CONFIG_USERNAME_DEFAULT), esc); + config_value(data, "table", CONFIG_TABLE_DEFAULT), + config_value_read(data, "username column", + CONFIG_USERNAME_DEFAULT), esc); return query; } @@ -304,293 +304,293 @@ fstring temp; fstring sid_str; pdb_sql_query *query; - int some_field_affected = 0; + int some_field_affected = 0; query = talloc(mem_ctx, pdb_sql_query); query->update = isupdate; - /* I know this is somewhat overkill but only the talloc - * functions have asprint_append and the 'normal' asprintf + /* I know this is somewhat overkill but only the talloc + * functions have asprint_append and the 'normal' asprintf * is a GNU extension */ query->part2 = talloc_asprintf(query, "%s", ""); if (query->update) { query->part1 = talloc_asprintf(query, "UPDATE %s SET ", - config_value(location, "table", - CONFIG_TABLE_DEFAULT)); + config_value(location, "table", + CONFIG_TABLE_DEFAULT)); } else { query->part1 = talloc_asprintf(query, "INSERT INTO %s (", - config_value(location, "table", - CONFIG_TABLE_DEFAULT)); + config_value(location, "table", + CONFIG_TABLE_DEFAULT)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_ACCTCTRL)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_int_field(query, - config_value_write(location, "acct ctrl column", - CONFIG_ACCT_CTRL_DEFAULT), - pdb_get_acct_ctrl(newpwd)); + config_value_write(location, "acct ctrl column", + CONFIG_ACCT_CTRL_DEFAULT), + pdb_get_acct_ctrl(newpwd)); } - + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONTIME)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_int_field(query, - config_value_write(location, - "logon time column", - CONFIG_LOGON_TIME_DEFAULT), - pdb_get_logon_time(newpwd)); + config_value_write(location, + "logon time column", + CONFIG_LOGON_TIME_DEFAULT), + pdb_get_logon_time(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGOFFTIME)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_int_field(query, - config_value_write(location, - "logoff time column", - CONFIG_LOGOFF_TIME_DEFAULT), - pdb_get_logoff_time(newpwd)); + config_value_write(location, + "logoff time column", + CONFIG_LOGOFF_TIME_DEFAULT), + pdb_get_logoff_time(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_KICKOFFTIME)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_int_field(query, - config_value_write(location, - "kickoff time column", - CONFIG_KICKOFF_TIME_DEFAULT), - pdb_get_kickoff_time(newpwd)); + config_value_write(location, + "kickoff time column", + CONFIG_KICKOFF_TIME_DEFAULT), + pdb_get_kickoff_time(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_CANCHANGETIME)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_int_field(query, - config_value_write(location, - "pass can change time column", - CONFIG_PASS_CAN_CHANGE_TIME_DEFAULT), - pdb_get_pass_can_change_time(newpwd)); + config_value_write(location, + "pass can change time column", + CONFIG_PASS_CAN_CHANGE_TIME_DEFAULT), + pdb_get_pass_can_change_time(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_MUSTCHANGETIME)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_int_field(query, - config_value_write(location, - "pass must change time column", - CONFIG_PASS_MUST_CHANGE_TIME_DEFAULT), - pdb_get_pass_must_change_time(newpwd)); + config_value_write(location, + "pass must change time column", + CONFIG_PASS_MUST_CHANGE_TIME_DEFAULT), + pdb_get_pass_must_change_time(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_PASSLASTSET)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_int_field(query, - config_value_write(location, - "pass last set time column", - CONFIG_PASS_LAST_SET_TIME_DEFAULT), - pdb_get_pass_last_set_time(newpwd)); + config_value_write(location, + "pass last set time column", + CONFIG_PASS_LAST_SET_TIME_DEFAULT), + pdb_get_pass_last_set_time(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_HOURSLEN)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_int_field(query, - config_value_write(location, - "hours len column", - CONFIG_HOURS_LEN_DEFAULT), - pdb_get_hours_len(newpwd)); + config_value_write(location, + "hours len column", + CONFIG_HOURS_LEN_DEFAULT), + pdb_get_hours_len(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONDIVS)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_int_field(query, - config_value_write(location, - "logon divs column", - CONFIG_LOGON_DIVS_DEFAULT), - pdb_get_logon_divs(newpwd)); + config_value_write(location, + "logon divs column", + CONFIG_LOGON_DIVS_DEFAULT), + pdb_get_logon_divs(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERSID)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_string_field(query, - config_value_write(location, "user sid column", - CONFIG_USER_SID_DEFAULT), - sid_to_fstring(sid_str, - /* sid_string_dbg(sid, */ - pdb_get_user_sid(newpwd))); - } + config_value_write(location, "user sid column", + CONFIG_USER_SID_DEFAULT), + sid_to_fstring(sid_str, + /* sid_string_dbg(sid, */ + pdb_get_user_sid(newpwd))); + } - if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_GROUPSID)) { - some_field_affected = 1; - pdb_sql_string_field(query, - config_value_write(location, "group sid column", - CONFIG_GROUP_SID_DEFAULT), - sid_to_fstring(sid_str, - pdb_get_group_sid(newpwd))); - } + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_GROUPSID)) { + some_field_affected = 1; + pdb_sql_string_field(query, + config_value_write(location, "group sid column", + CONFIG_GROUP_SID_DEFAULT), + sid_to_fstring(sid_str, + pdb_get_group_sid(newpwd))); + } - if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERNAME)) { - some_field_affected = 1; - pdb_sql_string_field(query, - config_value_write(location, "username column", - CONFIG_USERNAME_DEFAULT), - pdb_get_username(newpwd)); - } + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERNAME)) { + some_field_affected = 1; + pdb_sql_string_field(query, + config_value_write(location, "username column", + CONFIG_USERNAME_DEFAULT), + pdb_get_username(newpwd)); + } - if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_DOMAIN)) { - some_field_affected = 1; - pdb_sql_string_field(query, - config_value_write(location, "domain column", - CONFIG_DOMAIN_DEFAULT), - pdb_get_domain(newpwd)); - } + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_DOMAIN)) { + some_field_affected = 1; + pdb_sql_string_field(query, + config_value_write(location, "domain column", + CONFIG_DOMAIN_DEFAULT), + pdb_get_domain(newpwd)); + } - if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERNAME)) { - some_field_affected = 1; - pdb_sql_string_field(query, - config_value_write(location, - "nt username column", - CONFIG_NT_USERNAME_DEFAULT), - pdb_get_nt_username(newpwd)); - } + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERNAME)) { + some_field_affected = 1; + pdb_sql_string_field(query, + config_value_write(location, + "nt username column", + CONFIG_NT_USERNAME_DEFAULT), + pdb_get_nt_username(newpwd)); + } - if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_FULLNAME)) { - some_field_affected = 1; - pdb_sql_string_field(query, - config_value_write(location, "fullname column", - CONFIG_FULLNAME_DEFAULT), - pdb_get_fullname(newpwd)); - } + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_FULLNAME)) { + some_field_affected = 1; + pdb_sql_string_field(query, + config_value_write(location, "fullname column", + CONFIG_FULLNAME_DEFAULT), + pdb_get_fullname(newpwd)); + } - if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONSCRIPT)) { - some_field_affected = 1; - pdb_sql_string_field(query, - config_value_write(location, - "logon script column", - CONFIG_LOGON_SCRIPT_DEFAULT), - pdb_get_logon_script(newpwd)); - } + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONSCRIPT)) { + some_field_affected = 1; + pdb_sql_string_field(query, + config_value_write(location, + "logon script column", + CONFIG_LOGON_SCRIPT_DEFAULT), + pdb_get_logon_script(newpwd)); + } - if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_PROFILE)) { - some_field_affected = 1; - pdb_sql_string_field(query, - config_value_write(location, - "profile path column", - CONFIG_PROFILE_PATH_DEFAULT), - pdb_get_profile_path(newpwd)); - } - if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_ACCTDESC)) { - some_field_affected = 1; - pdb_sql_string_field(query, - config_value_write(location, "acct desc column", - CONFIG_ACCT_DESC_DEFAULT), - pdb_get_acct_desc(newpwd)); - } + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_PROFILE)) { + some_field_affected = 1; + pdb_sql_string_field(query, + config_value_write(location, + "profile path column", + CONFIG_PROFILE_PATH_DEFAULT), + pdb_get_profile_path(newpwd)); + } + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_ACCTDESC)) { + some_field_affected = 1; + pdb_sql_string_field(query, + config_value_write(location, "acct desc column", + CONFIG_ACCT_DESC_DEFAULT), + pdb_get_acct_desc(newpwd)); + } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_DRIVE)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_string_field(query, - config_value_write(location, "dir drive column", - CONFIG_DIR_DRIVE_DEFAULT), - pdb_get_dir_drive(newpwd)); + config_value_write(location, "dir drive column", + CONFIG_DIR_DRIVE_DEFAULT), + pdb_get_dir_drive(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_SMBHOME)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_string_field(query, - config_value_write(location, "home dir column", - CONFIG_HOME_DIR_DEFAULT), - pdb_get_homedir(newpwd)); + config_value_write(location, "home dir column", + CONFIG_HOME_DIR_DEFAULT), + pdb_get_homedir(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_WORKSTATIONS)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_string_field(query, - config_value_write(location, - "workstations column", - CONFIG_WORKSTATIONS_DEFAULT), - pdb_get_workstations(newpwd)); + config_value_write(location, + "workstations column", + CONFIG_WORKSTATIONS_DEFAULT), + pdb_get_workstations(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_COMMENT)) { - some_field_affected = 1; + some_field_affected = 1; pdb_sql_string_field(query, - config_value_write(location, - "unknown string column", - CONFIG_UNKNOWN_STR_DEFAULT), - pdb_get_comment(newpwd)); + config_value_write(location, + "unknown string column", + CONFIG_UNKNOWN_STR_DEFAULT), + pdb_get_comment(newpwd)); } if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LMPASSWD)) { some_field_affected = 1; pdb_sethexpwd(temp, pdb_get_lanman_passwd(newpwd), - pdb_get_acct_ctrl(newpwd)); + pdb_get_acct_ctrl(newpwd)); pdb_sql_string_field(query, - config_value_write(location, - "... [truncated message content] |
From: <he...@us...> - 2013-05-03 17:26:28
|
Revision: 176 http://sourceforge.net/p/pdbsql/code/176 Author: herwinw Date: 2013-05-03 17:26:24 +0000 (Fri, 03 May 2013) Log Message: ----------- Removed Jelmer Vernooij from the list of maintainers in the debian package By his own request: > You might want to remove me from the maintainers; I no longer am a maintainer of pdbsql. :) > > Cheers, > > Jelmer Modified Paths: -------------- branches/pdbsql_36/debian/control Modified: branches/pdbsql_36/debian/control =================================================================== --- branches/pdbsql_36/debian/control 2013-05-03 16:15:25 UTC (rev 175) +++ branches/pdbsql_36/debian/control 2013-05-03 17:26:24 UTC (rev 176) @@ -1,8 +1,7 @@ Source: samba-pdbsql Section: net Priority: optional -Maintainer: Jelmer Vernooij <je...@sa...> - Herwin Weststrate <he...@sn...> +Maintainer: Herwin Weststrate <he...@sn...> Standards-Version: 3.6.2 Build-Depends: libmysqlclient-dev, libpq-dev, debhelper (>> 4.0.0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Jelmer V. <je...@sa...> - 2013-05-03 16:55:45
|
On Fri, May 03, 2013 at 04:15:27PM +0000, he...@us... wrote: > Revision: 175 > http://sourceforge.net/p/pdbsql/code/175 > Author: herwinw > Date: 2013-05-03 16:15:25 +0000 (Fri, 03 May 2013) > Log Message: > ----------- > Fixed debian build scripts for branch samba-3.6 > > Still nothing has been tested except compilation.... > > Modified Paths: > -------------- > branches/pdbsql_36/debian/changelog > branches/pdbsql_36/debian/control > branches/pdbsql_36/debian/rules > > Modified: branches/pdbsql_36/debian/changelog > =================================================================== > --- branches/pdbsql_36/debian/changelog 2013-05-02 16:58:05 UTC (rev 174) > +++ branches/pdbsql_36/debian/changelog 2013-05-03 16:15:25 UTC (rev 175) > @@ -1,3 +1,9 @@ > +samba-pdbsql (3.6-0) UNRELEASED; urgency=low > + > + * Compatible with Samba 3.6.0 > + > + -- Herwin Weststrate <he...@sn...> Fri, 3 May 2013 17:55:47 +0200 > + > samba-pdbsql (0.04) UNRELEASED; urgency=low > > * Compatible with Samba 3.2.0 > > Modified: branches/pdbsql_36/debian/control > =================================================================== > --- branches/pdbsql_36/debian/control 2013-05-02 16:58:05 UTC (rev 174) > +++ branches/pdbsql_36/debian/control 2013-05-03 16:15:25 UTC (rev 175) > @@ -2,26 +2,27 @@ > Section: net > Priority: optional > Maintainer: Jelmer Vernooij <je...@sa...> > + Herwin Weststrate <he...@sn...> > Standards-Version: 3.6.2 You might want to remove me from the maintainers; I no longer am a maintainer of pdbsql. :-) Cheers, Jelmer |
From: <he...@us...> - 2013-05-03 16:15:29
|
Revision: 175 http://sourceforge.net/p/pdbsql/code/175 Author: herwinw Date: 2013-05-03 16:15:25 +0000 (Fri, 03 May 2013) Log Message: ----------- Fixed debian build scripts for branch samba-3.6 Still nothing has been tested except compilation.... Modified Paths: -------------- branches/pdbsql_36/debian/changelog branches/pdbsql_36/debian/control branches/pdbsql_36/debian/rules Modified: branches/pdbsql_36/debian/changelog =================================================================== --- branches/pdbsql_36/debian/changelog 2013-05-02 16:58:05 UTC (rev 174) +++ branches/pdbsql_36/debian/changelog 2013-05-03 16:15:25 UTC (rev 175) @@ -1,3 +1,9 @@ +samba-pdbsql (3.6-0) UNRELEASED; urgency=low + + * Compatible with Samba 3.6.0 + + -- Herwin Weststrate <he...@sn...> Fri, 3 May 2013 17:55:47 +0200 + samba-pdbsql (0.04) UNRELEASED; urgency=low * Compatible with Samba 3.2.0 Modified: branches/pdbsql_36/debian/control =================================================================== --- branches/pdbsql_36/debian/control 2013-05-02 16:58:05 UTC (rev 174) +++ branches/pdbsql_36/debian/control 2013-05-03 16:15:25 UTC (rev 175) @@ -2,26 +2,27 @@ Section: net Priority: optional Maintainer: Jelmer Vernooij <je...@sa...> + Herwin Weststrate <he...@sn...> Standards-Version: 3.6.2 -Build-Depends: libmysqlclient15-dev, libpq-dev, debhelper (>> 4.0.0) +Build-Depends: libmysqlclient-dev, libpq-dev, debhelper (>> 4.0.0) Package: samba-pdb-mysql Architecture: any -Depends: ${shlibs:Depends}, samba (>= 3.2.0) +Depends: ${shlibs:Depends}, samba (>= 3.6.0) Description: MySQL user database support for Samba This package adds support for storing Samba user information in MySQL. Package: samba-pdb-pgsql Architecture: any -Depends: ${shlibs:Depends}, samba (>= 3.2.0) +Depends: ${shlibs:Depends}, samba (>= 3.6.0) Description: PostGreSQL user database support for Samba This package adds support for storing Samba user information in PostGreSQL. Package: samba-pdb-multi Architecture: any -Depends: ${shlibs:Depends}, samba (>= 3.2.0) +Depends: ${shlibs:Depends}, samba (>= 3.6.0) Description: Support for concurrent user databases in Samba This package adds support to Samba for using multiple 'passdb backends' at the same time. This feature was removed Modified: branches/pdbsql_36/debian/rules =================================================================== --- branches/pdbsql_36/debian/rules 2013-05-02 16:58:05 UTC (rev 174) +++ branches/pdbsql_36/debian/rules 2013-05-03 16:15:25 UTC (rev 175) @@ -20,7 +20,7 @@ dh_testdir dh_testroot - dh_clean -k + dh_prep dh_installdirs $(MAKE) install DESTDIR=`pwd`/debian/tmp LIBDIR=/usr/lib/samba dh_install --sourcedir=`pwd`/debian/tmp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-05-02 16:58:08
|
Revision: 174 http://sourceforge.net/p/pdbsql/code/174 Author: herwinw Date: 2013-05-02 16:58:05 +0000 (Thu, 02 May 2013) Log Message: ----------- Added branch for samba 3.6 This has not been tested in any way, it just compiles with these changes and that's about it. Modified Paths: -------------- branches/pdbsql_36/pdb_multi.c branches/pdbsql_36/pdb_mysql.c branches/pdbsql_36/pdb_pgsql.c branches/pdbsql_36/pdb_sql.h Added Paths: ----------- branches/pdbsql_36/ Modified: branches/pdbsql_36/pdb_multi.c =================================================================== --- branches/pdbsql_34/pdb_multi.c 2010-02-18 19:49:59 UTC (rev 173) +++ branches/pdbsql_36/pdb_multi.c 2013-05-02 16:58:05 UTC (rev 174) @@ -20,13 +20,14 @@ * TODO * * Volker commited Trust domain passwords to be included in the pdb. * These need to be added here: - * bool get_trusteddom_pw(struct pdb_methods *methods, const char *domain, char **pwd, DOM_SID *sid, time_t *pass_last_set_time) - * bool set_trusteddom_pw(struct pdb_methods *methods, const char *domain, const char *pwd, const DOM_SID *sid) + * bool get_trusteddom_pw(struct pdb_methods *methods, const char *domain, char **pwd, struct dom_sid *sid, time_t *pass_last_set_time) + * bool set_trusteddom_pw(struct pdb_methods *methods, const char *domain, const char *pwd, const struct dom_sid *sid) * bool del_trusteddom_pw(struct pdb_methods *methods, const char *domain) * NTSTATUS enum_trusteddoms(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, uint32 *num_domains, struct trustdom_info ***domains) */ #include "includes.h" +#include "passdb.h" static int multisam_debug_level = DBGC_ALL; @@ -172,7 +173,7 @@ static bool multisam_search_aliases(struct pdb_methods *methods, struct pdb_search *search, - const DOM_SID *sid) + const struct dom_sid *sid) { return false; } @@ -222,7 +223,7 @@ /* Tries gid_to_sid on every backend until one succeeds, returns true on success */ static bool multisam_gid_to_sid(struct pdb_methods *methods, gid_t gid, - DOM_SID *sid) + struct dom_sid *sid) { short i; struct multisam_data *data; @@ -244,7 +245,7 @@ /* Tries sid_to_id on every backend until one succeeds, returns true on success */ static bool multisam_sid_to_id(struct pdb_methods *methods, - const DOM_SID *sid, + const struct dom_sid *sid, union unid_t *id, enum lsa_SidType *type) { short i; @@ -324,7 +325,7 @@ static NTSTATUS multisam_enum_group_memberships(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, struct samu *user, - DOM_SID **pp_sids, + struct dom_sid **pp_sids, gid_t **pp_gids, size_t *p_num_groups) { @@ -335,7 +336,7 @@ static NTSTATUS multisam_enum_group_members(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, - const DOM_SID *group, + const struct dom_sid *group, uint32 **pp_member_rids, size_t *p_num_members) { @@ -360,7 +361,7 @@ } static NTSTATUS multisam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map, - DOM_SID sid) + struct dom_sid sid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -420,7 +421,7 @@ } static NTSTATUS multisam_delete_group_mapping_entry(struct pdb_methods *methods, - DOM_SID sid) + struct dom_sid sid) { short i; struct multisam_data *data; @@ -441,7 +442,7 @@ #if 0 static NTSTATUS multisam_enum_group_mapping(struct pdb_methods *methods, - const DOM_SID *sid, enum SID_NAME_USE sid_name_use, + const struct dom_sid *sid, enum SID_NAME_USE sid_name_use, GROUP_MAP **pp_rmap, size_t *p_num_entries, bool unix_only) { @@ -450,7 +451,7 @@ } static NTSTATUS multisam_find_alias(struct pdb_methods *methods, - const char *name, DOM_SID *sid) + const char *name, struct dom_sid *sid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; @@ -464,14 +465,14 @@ } static NTSTATUS multisam_delete_alias(struct pdb_methods *methods, - const DOM_SID *sid) + const struct dom_sid *sid) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_get_aliasinfo(struct pdb_methods *methods, - const DOM_SID *sid, + const struct dom_sid *sid, struct acct_info *info) { DEBUG(1, ("This function is not implemented yet\n")); @@ -479,7 +480,7 @@ } static NTSTATUS multisam_set_aliasinfo(struct pdb_methods *methods, - const DOM_SID *sid, + const struct dom_sid *sid, struct acct_info *info) { DEBUG(1, ("This function is not implemented yet\n")); @@ -487,21 +488,21 @@ } static NTSTATUS multisam_add_aliasmem(struct pdb_methods *methods, - const DOM_SID *alias, const DOM_SID *member) + const struct dom_sid *alias, const struct dom_sid *member) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_del_aliasmem(struct pdb_methods *methods, - const DOM_SID *alias, const DOM_SID *member) + const struct dom_sid *alias, const struct dom_sid *member) { DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } NTSTATUS multisam_enum_aliasmem(struct pdb_methods *methods, - const DOM_SID *alias, DOM_SID **pp_members, + const struct dom_sid *alias, struct dom_sid **pp_members, size_t *p_num_members) { DEBUG(1, ("This function is not implemented yet\n")); @@ -510,8 +511,8 @@ static NTSTATUS multisam_alias_memberships(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, - const DOM_SID *domain_sid, - const DOM_SID *members, + const struct dom_sid *domain_sid, + const struct dom_sid *members, size_t num_members, uint32 **pp_alias_rids, size_t *p_num_alias_rids) @@ -615,7 +616,7 @@ **************************************************************************/ /* Tries to find the account in all backends until it succeeds or runs out of backends */ static NTSTATUS multisam_getsampwsid(struct pdb_methods *methods, struct samu * user, - const DOM_SID * sid) + const struct dom_sid * sid) { short i; struct multisam_data *data; @@ -703,7 +704,7 @@ #if 0 static NTSTATUS multisam_lookup_rids(struct pdb_methods *methods, - const DOM_SID *domain_sid, + const struct dom_sid *domain_sid, int num_rids, uint32 *rids, const char **names, Modified: branches/pdbsql_36/pdb_mysql.c =================================================================== --- branches/pdbsql_34/pdb_mysql.c 2010-02-18 19:49:59 UTC (rev 173) +++ branches/pdbsql_36/pdb_mysql.c 2013-05-02 16:58:05 UTC (rev 174) @@ -20,13 +20,14 @@ * TODO * * Volker commited Trust domain passwords to be included in the pdb. * These need to be added here: - * bool get_trusteddom_pw(struct pdb_methods *methods, const char *domain, char **pwd, DOM_SID *sid, time_t *pass_last_set_time) - * bool set_trusteddom_pw(struct pdb_methods *methods, const char *domain, const char *pwd, const DOM_SID *sid) + * bool get_trusteddom_pw(struct pdb_methods *methods, const char *domain, char **pwd, struct dom_sid *sid, time_t *pass_last_set_time) + * bool set_trusteddom_pw(struct pdb_methods *methods, const char *domain, const char *pwd, const struct dom_sid *sid) * bool del_trusteddom_pw(struct pdb_methods *methods, const char *domain) * NTSTATUS enum_trusteddoms(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, uint32 *num_domains, struct trustdom_info ***domains) */ #include "pdb_sql.h" +#include "libcli/security/dom_sid.h" #include <mysql.h> #include <errmsg.h> @@ -123,10 +124,8 @@ { MYSQL_ROW row; unsigned char pwd[16]; - unsigned int num_fields; - DOM_SID sid; + struct dom_sid sid; - num_fields = mysql_num_fields(r); row = mysql_fetch_row(r); if (!row) { DEBUG(10, ("empty result")); @@ -179,7 +178,7 @@ pdb_set_bad_password_count(u, xatol(row[26]), PDB_SET); pdb_set_logon_count(u, xatol(row[27]), PDB_SET); pdb_set_unknown_6(u, xatol(row[28]), PDB_SET); - pdb_set_hours(u, (uint8 *)row[29], PDB_SET); + pdb_set_hours(u, (uint8 *)row[29], xatol(row[25]), PDB_SET); if (row[30]) { uint8 pwhist[MAX_PW_HISTORY_LEN * PW_HISTORY_ENTRY_LEN]; @@ -284,7 +283,7 @@ **************************************************************************/ static NTSTATUS mysqlsam_getsampwsid(struct pdb_methods *methods, struct samu * user, - const DOM_SID * sid) + const struct dom_sid * sid) { struct pdb_mysql_data *data; fstring sid_str; @@ -436,7 +435,7 @@ struct mysqlsam_search_state *state = talloc_get_type_abort( search->private_data, struct mysqlsam_search_state); MYSQL_ROW row; - DOM_SID sid; + struct dom_sid sid; if (state->current >= state->num_entries) { return false; Modified: branches/pdbsql_36/pdb_pgsql.c =================================================================== --- branches/pdbsql_34/pdb_pgsql.c 2010-02-18 19:49:59 UTC (rev 173) +++ branches/pdbsql_36/pdb_pgsql.c 2013-05-02 16:58:05 UTC (rev 174) @@ -21,13 +21,14 @@ * TODO * * Volker commited Trust domain passwords to be included in the pdb. * These need to be added here: - * bool get_trusteddom_pw(struct pdb_methods *methods, const char *domain, char **pwd, DOM_SID *sid, time_t *pass_last_set_time) - * bool set_trusteddom_pw(struct pdb_methods *methods, const char *domain, const char *pwd, const DOM_SID *sid) + * bool get_trusteddom_pw(struct pdb_methods *methods, const char *domain, char **pwd, struct dom_sid *sid, time_t *pass_last_set_time) + * bool set_trusteddom_pw(struct pdb_methods *methods, const char *domain, const char *pwd, const struct dom_sid *sid) * bool del_trusteddom_pw(struct pdb_methods *methods, const char *domain) * NTSTATUS enum_trusteddoms(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, uint32 *num_domains, struct trustdom_info ***domains) */ #include "pdb_sql.h" +#include "libcli/security/dom_sid.h" #include <libpq-fe.h> /* To prevent duplicate defines */ @@ -165,7 +166,7 @@ static NTSTATUS row_to_sam_account (PGresult *r, long row, struct samu *u) { unsigned char temp[16]; - DOM_SID sid; + struct dom_sid sid; unsigned char *hours; size_t hours_len = 0; @@ -203,7 +204,7 @@ if (hours != NULL) { hours = PQunescapeBytea(hours, &hours_len); if (hours_len > 0) { - pdb_set_hours(u, hours, PDB_SET); + pdb_set_hours(u, hours, PQgetlong(r, row, 25), PDB_SET); } } @@ -318,7 +319,8 @@ lowercasename = talloc_strdup(data, sname); l = strlen(lowercasename); for(i = 0; i < l; i++) { - lowercasename[i] = tolower_ascii(lowercasename[i]); + smb_ucs2_t uc = tolower_w(UCS2_CHAR(lowercasename[i])); + lowercasename[i] = UCS2_TO_CHAR(uc); } result = pgsqlsam_select_by_field(methods, user, SQL_SEARCH_USER_NAME, lowercasename); @@ -333,13 +335,10 @@ Search by sid **************************************************************************/ -static NTSTATUS pgsqlsam_getsampwsid(struct pdb_methods *methods, struct samu *user, const DOM_SID *sid) +static NTSTATUS pgsqlsam_getsampwsid(struct pdb_methods *methods, struct samu *user, const struct dom_sid *sid) { - struct pdb_pgsql_data *data; fstring sid_str; - SET_DATA(data, methods); - sid_to_fstring(sid_str, sid); return pgsqlsam_select_by_field(methods, user, SQL_SEARCH_USER_SID, sid_str); @@ -465,7 +464,7 @@ struct samr_displayentry *entry) { struct pdb_pgsql_search_state *search_state; - DOM_SID sid; + struct dom_sid sid; PGresult *r; long row; Modified: branches/pdbsql_36/pdb_sql.h =================================================================== --- branches/pdbsql_34/pdb_sql.h 2010-02-18 19:49:59 UTC (rev 173) +++ branches/pdbsql_36/pdb_sql.h 2013-05-02 16:58:05 UTC (rev 174) @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "passdb.h" #ifndef _PDB_SQL_H #define _PDB_SQL_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-02-18 19:50:24
|
Revision: 173 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=173&view=rev Author: herwinw Date: 2010-02-18 19:49:59 +0000 (Thu, 18 Feb 2010) Log Message: ----------- merged r172 to all other `active' branches Modified Paths: -------------- branches/pdbsql_32-test/docs/README branches/pdbsql_3_2/docs/README trunk/docs/README Property Changed: ---------------- branches/pdbsql_32-test/docs/README branches/pdbsql_3_2/docs/README trunk/docs/README Modified: branches/pdbsql_32-test/docs/README =================================================================== --- branches/pdbsql_32-test/docs/README 2010-02-18 19:46:03 UTC (rev 172) +++ branches/pdbsql_32-test/docs/README 2010-02-18 19:49:59 UTC (rev 173) @@ -8,6 +8,7 @@ $ ./configure $ make proto $ cd $PDBSQLDIR +$ ./autogen.sh $ ./configure --with-samba-dir=$SAMBADIR $ make $ make install Property changes on: branches/pdbsql_32-test/docs/README ___________________________________________________________________ Added: svn:mergeinfo + /branches/pdbsql_34/docs/README:169,172 Modified: branches/pdbsql_3_2/docs/README =================================================================== --- branches/pdbsql_3_2/docs/README 2010-02-18 19:46:03 UTC (rev 172) +++ branches/pdbsql_3_2/docs/README 2010-02-18 19:49:59 UTC (rev 173) @@ -8,6 +8,7 @@ $ ./configure $ make proto $ cd $PDBSQLDIR +$ ./autogen.sh $ ./configure --with-samba-dir=$SAMBADIR $ make $ make install Property changes on: branches/pdbsql_3_2/docs/README ___________________________________________________________________ Added: svn:mergeinfo + /branches/pdbsql_34/docs/README:169,172 Modified: trunk/docs/README =================================================================== --- trunk/docs/README 2010-02-18 19:46:03 UTC (rev 172) +++ trunk/docs/README 2010-02-18 19:49:59 UTC (rev 173) @@ -8,6 +8,7 @@ $ ./configure $ make proto $ cd $PDBSQLDIR +$ ./autogen.sh $ ./configure --with-samba-dir=$SAMBADIR $ make $ make install Property changes on: trunk/docs/README ___________________________________________________________________ Added: svn:mergeinfo + /branches/pdbsql_34/docs/README:169,172 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-02-18 19:46:29
|
Revision: 172 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=172&view=rev Author: herwinw Date: 2010-02-18 19:46:03 +0000 (Thu, 18 Feb 2010) Log Message: ----------- Added hint to run autogen before configure Modified Paths: -------------- branches/pdbsql_34/docs/README Modified: branches/pdbsql_34/docs/README =================================================================== --- branches/pdbsql_34/docs/README 2010-01-17 11:35:44 UTC (rev 171) +++ branches/pdbsql_34/docs/README 2010-02-18 19:46:03 UTC (rev 172) @@ -8,6 +8,7 @@ $ ./configure $ make proto $ cd $PDBSQLDIR +$ ./autogen.sh $ ./configure --with-samba-dir=$SAMBADIR $ make $ make install This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-01-17 11:36:08
|
Revision: 171 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=171&view=rev Author: herwinw Date: 2010-01-17 11:35:44 +0000 (Sun, 17 Jan 2010) Log Message: ----------- Some minor changes to allow the 3.4 plugin to work with samba 3.5 (PASSDB_INTERFACE_VERSION 19) Tested with Samba 3.5.0rc1 Modified Paths: -------------- branches/pdbsql_34/pdb_multi.c branches/pdbsql_34/pdb_mysql.c branches/pdbsql_34/pdb_pgsql.c branches/pdbsql_34/pdb_sql.c Modified: branches/pdbsql_34/pdb_multi.c =================================================================== --- branches/pdbsql_34/pdb_multi.c 2010-01-12 22:14:45 UTC (rev 170) +++ branches/pdbsql_34/pdb_multi.c 2010-01-17 11:35:44 UTC (rev 171) @@ -196,6 +196,7 @@ } #endif +#if PASSDB_INTERFACE_VERSION < 19 /* Tries uid_to_rid on every backend until one succeeds, returns true on success */ static bool multisam_uid_to_rid(struct pdb_methods *methods, uid_t uid, uint32 *rid) @@ -217,6 +218,7 @@ return false; } +#endif /* Tries gid_to_sid on every backend until one succeeds, returns true on success */ static bool multisam_gid_to_sid(struct pdb_methods *methods, gid_t gid, @@ -287,9 +289,15 @@ /* Get a new free rid if necessary */ +#if PASSDB_INTERFACE_VERSION < 19 if (data->methods[0]->rid_algorithm(data->methods[0])) { multisam_new_rid(methods, rid, 0); } +#else + if (data->methods[0]->capabilities(data->methods[0])) { + multisam_new_rid(methods, rid, 0); + } +#endif return data->methods[0]->create_user(data->methods[0], tmp_ctx, name, acb_info, rid); } @@ -732,11 +740,19 @@ } #endif +#if PASSDB_INTERFACE_VERSION < 19 /* The rid algorithm of the first backend is used. */ static bool multisam_rid_algorithm (struct pdb_methods *methods) { return true; } +#else +/* The capabilities of the first backend is used. */ +static uint32_t multisam_capabilities (struct pdb_methods *methods) +{ + return PDB_CAP_STORE_RIDS | PDB_CAP_ADS; +} +#endif /* This function is a fallback for errors */ static bool multisam_dummy_new_rid (struct pdb_methods *methods, uint32 *rid) { @@ -783,12 +799,18 @@ (*pdb_method)->update_sam_account = multisam_update_sam_account; (*pdb_method)->delete_sam_account = multisam_delete_sam_account; (*pdb_method)->rename_sam_account = multisam_rename_sam_account; +#if PASSDB_INTERFACE_VERSION < 19 (*pdb_method)->rid_algorithm = multisam_rid_algorithm; +#else + (*pdb_method)->capabilities = multisam_capabilities; +#endif (*pdb_method)->new_rid = multisam_dummy_new_rid; (*pdb_method)->create_user = multisam_create_user; (*pdb_method)->delete_user = multisam_delete_user; +#if PASSDB_INTERFACE_VERSION < 19 (*pdb_method)->uid_to_rid = multisam_uid_to_rid; +#endif (*pdb_method)->gid_to_sid = multisam_gid_to_sid; (*pdb_method)->sid_to_id = multisam_sid_to_id; Modified: branches/pdbsql_34/pdb_mysql.c =================================================================== --- branches/pdbsql_34/pdb_mysql.c 2010-01-12 22:14:45 UTC (rev 170) +++ branches/pdbsql_34/pdb_mysql.c 2010-01-17 11:35:44 UTC (rev 171) @@ -408,9 +408,15 @@ return mysqlsam_replace_sam_account(methods, newpwd, 1); } +#if PASSDB_INTERFACE_VERSION < 19 static bool mysqlsam_rid_algorithm (struct pdb_methods *pdb_methods) { return true; } +#else +static uint32_t mysqlsam_capabilities (struct pdb_methods *pdb_methods) { + return PDB_CAP_STORE_RIDS | PDB_CAP_ADS; +} +#endif static bool mysqlsam_new_rid (struct pdb_methods *pdb_methods, uint32 *rid) { return false; } @@ -540,7 +546,11 @@ (*pdb_method)->add_sam_account = mysqlsam_add_sam_account; (*pdb_method)->update_sam_account = mysqlsam_update_sam_account; (*pdb_method)->delete_sam_account = mysqlsam_delete_sam_account; - (*pdb_method)->rid_algorithm = mysqlsam_rid_algorithm; +#if PASSDB_INTERFACE_VERSION < 19 + (*pdb_method)->rid_algorithm = mysqlsam_rid_algorithm; +#else + (*pdb_method)->capabilities = mysqlsam_capabilities; +#endif (*pdb_method)->new_rid = mysqlsam_new_rid; data = talloc(*pdb_method, struct pdb_mysql_data); Modified: branches/pdbsql_34/pdb_pgsql.c =================================================================== --- branches/pdbsql_34/pdb_pgsql.c 2010-01-12 22:14:45 UTC (rev 170) +++ branches/pdbsql_34/pdb_pgsql.c 2010-01-17 11:35:44 UTC (rev 171) @@ -442,10 +442,17 @@ return pgsqlsam_replace_sam_account(methods, newpwd, 1); } +#if PASSDB_INTERFACE_VERSION < 19 static bool pgsqlsam_rid_algorithm(struct pdb_methods *pdb_methods) { return true; } +#else +static uint32_t pgsqlsam_capabilities(struct pdb_methods *pdb_methods) +{ + return PDB_CAP_STORE_RIDS | PDB_CAP_ADS; +} +#endif static bool pgsqlsam_new_rid(struct pdb_methods *pdb_methods, uint32 *rid) { return false; @@ -593,7 +600,11 @@ (*pdb_method)->add_sam_account = pgsqlsam_add_sam_account; (*pdb_method)->update_sam_account = pgsqlsam_update_sam_account; (*pdb_method)->delete_sam_account = pgsqlsam_delete_sam_account; +#if PASSDB_INTERFACE_VERSION < 19 (*pdb_method)->rid_algorithm = pgsqlsam_rid_algorithm; +#else + (*pdb_method)->capabilities = pgsqlsam_capabilities; +#endif (*pdb_method)->new_rid = pgsqlsam_new_rid; data = talloc(*pdb_method, struct pdb_pgsql_data); Modified: branches/pdbsql_34/pdb_sql.c =================================================================== --- branches/pdbsql_34/pdb_sql.c 2010-01-12 22:14:45 UTC (rev 170) +++ branches/pdbsql_34/pdb_sql.c 2010-01-17 11:35:44 UTC (rev 171) @@ -553,7 +553,11 @@ pwhist = pdb_get_pw_history(newpwd, &pw_history_len); +#if PASSDB_INTERFACE_VERSION < 19 pdb_get_account_policy(AP_PASSWORD_HISTORY, &max_history_len); +#else + pdb_get_account_policy(PDB_POLICY_PASSWORD_HISTORY, &pw_history_len); +#endif some_field_affected = 1; for (i = 0; i < max_history_len && i < pw_history_len; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-01-12 22:15:15
|
Revision: 170 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=170&view=rev Author: herwinw Date: 2010-01-12 22:14:45 +0000 (Tue, 12 Jan 2010) Log Message: ----------- Backported r169 to all other available branches/trunk Modified Paths: -------------- branches/pdbsql/Makefile.in branches/pdbsql/configure.in branches/pdbsql_32-test/Makefile.in branches/pdbsql_32-test/configure.in branches/pdbsql_3_2/Makefile.in branches/pdbsql_3_2/configure.in branches/pdbsql_old/samba-pdbsql-3028/Makefile.in branches/pdbsql_old/samba-pdbsql-3028/configure.in trunk/Makefile.in trunk/configure.in Property Changed: ---------------- branches/pdbsql/ branches/pdbsql_32-test/ branches/pdbsql_3_2/ branches/pdbsql_old/samba-pdbsql-3028/ trunk/ Property changes on: branches/pdbsql ___________________________________________________________________ Added: svn:mergeinfo + /branches/pdbsql_34:169 Modified: branches/pdbsql/Makefile.in =================================================================== --- branches/pdbsql/Makefile.in 2010-01-12 16:56:30 UTC (rev 169) +++ branches/pdbsql/Makefile.in 2010-01-12 22:14:45 UTC (rev 170) @@ -11,7 +11,7 @@ PGSQL_LIBS = @PGSQL_LIBS@ SOURCEDIR = @SOURCEDIR@ LIBDIR = @LIBDIR@ -CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc +CFLAGS = @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc all: $(addsuffix .$(SHLIBEXT), $(modules)) Modified: branches/pdbsql/configure.in =================================================================== --- branches/pdbsql/configure.in 2010-01-12 16:56:30 UTC (rev 169) +++ branches/pdbsql/configure.in 2010-01-12 22:14:45 UTC (rev 170) @@ -4,6 +4,10 @@ AC_CONFIG_HEADER(config.h) AC_PROG_CC +# Only add -Wall if we're using GCC +if test "x$GCC" = "xyes"; then + CFLAGS="-Wall $CFLAGS" +fi AC_SUBST(CFLAGS) SHLIBEXT="so" Property changes on: branches/pdbsql_32-test ___________________________________________________________________ Added: svn:mergeinfo + /branches/pdbsql_34:169 Modified: branches/pdbsql_32-test/Makefile.in =================================================================== --- branches/pdbsql_32-test/Makefile.in 2010-01-12 16:56:30 UTC (rev 169) +++ branches/pdbsql_32-test/Makefile.in 2010-01-12 22:14:45 UTC (rev 170) @@ -11,7 +11,7 @@ PGSQL_LIBS = @PGSQL_LIBS@ SOURCEDIR = @SOURCEDIR@ LIBDIR = @LIBDIR@ -CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc -I$(SOURCEDIR)/lib/tdb/include -I$(SOURCEDIR)/lib/talloc +CFLAGS = @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc -I$(SOURCEDIR)/lib/tdb/include -I$(SOURCEDIR)/lib/talloc all: $(addsuffix .$(SHLIBEXT), $(modules)) Modified: branches/pdbsql_32-test/configure.in =================================================================== --- branches/pdbsql_32-test/configure.in 2010-01-12 16:56:30 UTC (rev 169) +++ branches/pdbsql_32-test/configure.in 2010-01-12 22:14:45 UTC (rev 170) @@ -4,6 +4,10 @@ AC_CONFIG_HEADER(config.h) AC_PROG_CC +# Only add -Wall if we're using GCC +if test "x$GCC" = "xyes"; then + CFLAGS="-Wall $CFLAGS" +fi AC_SUBST(CFLAGS) SHLIBEXT="so" Property changes on: branches/pdbsql_3_2 ___________________________________________________________________ Added: svn:mergeinfo + /branches/pdbsql_34:169 Modified: branches/pdbsql_3_2/Makefile.in =================================================================== --- branches/pdbsql_3_2/Makefile.in 2010-01-12 16:56:30 UTC (rev 169) +++ branches/pdbsql_3_2/Makefile.in 2010-01-12 22:14:45 UTC (rev 170) @@ -11,7 +11,7 @@ PGSQL_LIBS = @PGSQL_LIBS@ SOURCEDIR = @SOURCEDIR@ LIBDIR = @LIBDIR@ -CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc +CFLAGS = @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc all: $(addsuffix .$(SHLIBEXT), $(modules)) Modified: branches/pdbsql_3_2/configure.in =================================================================== --- branches/pdbsql_3_2/configure.in 2010-01-12 16:56:30 UTC (rev 169) +++ branches/pdbsql_3_2/configure.in 2010-01-12 22:14:45 UTC (rev 170) @@ -4,6 +4,10 @@ AC_CONFIG_HEADER(config.h) AC_PROG_CC +# Only add -Wall if we're using GCC +if test "x$GCC" = "xyes"; then + CFLAGS="-Wall $CFLAGS" +fi AC_SUBST(CFLAGS) SHLIBEXT="so" Property changes on: branches/pdbsql_old/samba-pdbsql-3028 ___________________________________________________________________ Added: svn:mergeinfo + /branches/pdbsql_34:169 Modified: branches/pdbsql_old/samba-pdbsql-3028/Makefile.in =================================================================== --- branches/pdbsql_old/samba-pdbsql-3028/Makefile.in 2010-01-12 16:56:30 UTC (rev 169) +++ branches/pdbsql_old/samba-pdbsql-3028/Makefile.in 2010-01-12 22:14:45 UTC (rev 170) @@ -11,7 +11,7 @@ PGSQL_LIBS = @PGSQL_LIBS@ SOURCEDIR = @SOURCEDIR@ LIBDIR = @LIBDIR@ -CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc +CFLAGS = @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc all: $(addsuffix .$(SHLIBEXT), $(modules)) Modified: branches/pdbsql_old/samba-pdbsql-3028/configure.in =================================================================== --- branches/pdbsql_old/samba-pdbsql-3028/configure.in 2010-01-12 16:56:30 UTC (rev 169) +++ branches/pdbsql_old/samba-pdbsql-3028/configure.in 2010-01-12 22:14:45 UTC (rev 170) @@ -4,6 +4,10 @@ AC_CONFIG_HEADER(config.h) AC_PROG_CC +# Only add -Wall if we're using GCC +if test "x$GCC" = "xyes"; then + CFLAGS="-Wall $CFLAGS" +fi AC_SUBST(CFLAGS) SHLIBEXT="so" Property changes on: trunk ___________________________________________________________________ Added: svn:mergeinfo + /branches/pdbsql_34:169 Modified: trunk/Makefile.in =================================================================== --- trunk/Makefile.in 2010-01-12 16:56:30 UTC (rev 169) +++ trunk/Makefile.in 2010-01-12 22:14:45 UTC (rev 170) @@ -11,7 +11,7 @@ PGSQL_LIBS = @PGSQL_LIBS@ SOURCEDIR = @SOURCEDIR@ LIBDIR = @LIBDIR@ -CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc +CFLAGS = @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc all: $(addsuffix .$(SHLIBEXT), $(modules)) Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2010-01-12 16:56:30 UTC (rev 169) +++ trunk/configure.in 2010-01-12 22:14:45 UTC (rev 170) @@ -4,6 +4,10 @@ AC_CONFIG_HEADER(config.h) AC_PROG_CC +# Only add -Wall if we're using GCC +if test "x$GCC" = "xyes"; then + CFLAGS="-Wall $CFLAGS" +fi AC_SUBST(CFLAGS) SHLIBEXT="so" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-01-12 16:57:13
|
Revision: 169 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=169&view=rev Author: herwinw Date: 2010-01-12 16:56:30 +0000 (Tue, 12 Jan 2010) Log Message: ----------- Moved cc option `-Wall' from Makefile to configure. This should only be used when we're using GCC (see ticket 2924381) Modified Paths: -------------- branches/pdbsql_34/Makefile.in branches/pdbsql_34/configure.in Modified: branches/pdbsql_34/Makefile.in =================================================================== --- branches/pdbsql_34/Makefile.in 2009-08-04 19:20:17 UTC (rev 168) +++ branches/pdbsql_34/Makefile.in 2010-01-12 16:56:30 UTC (rev 169) @@ -12,7 +12,7 @@ TALLOC_LIBS = -ltalloc SOURCEDIR = @SOURCEDIR@ LIBDIR = @LIBDIR@ -CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR)/source3 -I$(SOURCEDIR)/source3/include -I$(SOURCEDIR)/source3/librpc -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/lib/tdb/include -I$(SOURCEDIR)/lib/tevent -I$(SOURCEDIR)/ -I$(SOURCEDIR)/lib/talloc +CFLAGS = @CFLAGS@ -I$(SOURCEDIR)/source3 -I$(SOURCEDIR)/source3/include -I$(SOURCEDIR)/source3/librpc -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/lib/tdb/include -I$(SOURCEDIR)/lib/tevent -I$(SOURCEDIR)/ -I$(SOURCEDIR)/lib/talloc all: $(addsuffix .$(SHLIBEXT), $(modules)) Modified: branches/pdbsql_34/configure.in =================================================================== --- branches/pdbsql_34/configure.in 2009-08-04 19:20:17 UTC (rev 168) +++ branches/pdbsql_34/configure.in 2010-01-12 16:56:30 UTC (rev 169) @@ -4,6 +4,10 @@ AC_CONFIG_HEADER(config.h) AC_PROG_CC +# Only add -Wall if we're using GCC +if test "x$GCC" = "xyes"; then + CFLAGS="-Wall $CFLAGS" +fi AC_SUBST(CFLAGS) SHLIBEXT="so" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-08-04 19:20:51
|
Revision: 168 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=168&view=rev Author: herwinw Date: 2009-08-04 19:20:17 +0000 (Tue, 04 Aug 2009) Log Message: ----------- replaced smb_xstrdup with talloc_strdup Modified Paths: -------------- branches/pdbsql_34/pdb_mysql.c branches/pdbsql_34/pdb_pgsql.c Modified: branches/pdbsql_34/pdb_mysql.c =================================================================== --- branches/pdbsql_34/pdb_mysql.c 2009-08-04 17:47:28 UTC (rev 167) +++ branches/pdbsql_34/pdb_mysql.c 2009-08-04 19:20:17 UTC (rev 168) @@ -553,7 +553,7 @@ return NT_STATUS_INVALID_PARAMETER; } - data->location = smb_xstrdup(location); + data->location = talloc_strdup(data, location); DEBUG(1, ("Connecting to database server, host: %s, user: %s, database: %s, port: %ld\n", Modified: branches/pdbsql_34/pdb_pgsql.c =================================================================== --- branches/pdbsql_34/pdb_pgsql.c 2009-08-04 17:47:28 UTC (rev 167) +++ branches/pdbsql_34/pdb_pgsql.c 2009-08-04 19:20:17 UTC (rev 168) @@ -315,7 +315,7 @@ return NT_STATUS_INVALID_PARAMETER; } - lowercasename = smb_xstrdup(sname); + lowercasename = talloc_strdup(data, sname); l = strlen(lowercasename); for(i = 0; i < l; i++) { lowercasename[i] = tolower_ascii(lowercasename[i]); @@ -323,7 +323,7 @@ result = pgsqlsam_select_by_field(methods, user, SQL_SEARCH_USER_NAME, lowercasename); - SAFE_FREE(lowercasename); + talloc_free(lowercasename); return result; } @@ -607,7 +607,7 @@ return NT_STATUS_INVALID_PARAMETER; } - data->location = smb_xstrdup(location); + data->location = talloc_strdup(data, location); if(!sql_account_config_valid(data->location)) { return NT_STATUS_INVALID_PARAMETER; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-08-04 17:47:34
|
Revision: 167 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=167&view=rev Author: herwinw Date: 2009-08-04 17:47:28 +0000 (Tue, 04 Aug 2009) Log Message: ----------- Added talloc libraries to the makefile, it works at first sight The --with-samba-dir directive should now point at the root of the source, *not* at the source3 directory inside Modified Paths: -------------- branches/pdbsql_34/Makefile.in branches/pdbsql_34/configure.in Modified: branches/pdbsql_34/Makefile.in =================================================================== --- branches/pdbsql_34/Makefile.in 2009-08-03 21:24:03 UTC (rev 166) +++ branches/pdbsql_34/Makefile.in 2009-08-04 17:47:28 UTC (rev 167) @@ -9,9 +9,10 @@ MYSQL_LIBS = @MYSQL_LIBS@ PGSQL_LIBS = @PGSQL_LIBS@ +TALLOC_LIBS = -ltalloc SOURCEDIR = @SOURCEDIR@ LIBDIR = @LIBDIR@ -CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/librpc -I$(SOURCEDIR)/../lib/replace -I$(SOURCEDIR)/../lib/tdb/include -I$(SOURCEDIR)/../lib/tevent -I$(SOURCEDIR)/.. +CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR)/source3 -I$(SOURCEDIR)/source3/include -I$(SOURCEDIR)/source3/librpc -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/lib/tdb/include -I$(SOURCEDIR)/lib/tevent -I$(SOURCEDIR)/ -I$(SOURCEDIR)/lib/talloc all: $(addsuffix .$(SHLIBEXT), $(modules)) @@ -19,13 +20,13 @@ $(CC) $(CFLAGS) -fPIC -c $< mysql.$(SHLIBEXT): pdb_mysql.o pdb_sql.o - $(CC) -shared -o $@ $^ $(MYSQL_LIBS) + $(CC) -shared -o $@ $^ $(MYSQL_LIBS) $(TALLOC_LIBS) pgsql.$(SHLIBEXT): pdb_pgsql.o pdb_sql.o - $(CC) -shared -o $@ $^ $(PGSQL_LIBS) + $(CC) -shared -o $@ $^ $(PGSQL_LIBS) $(TALLOC_LIBS) multi.$(SHLIBEXT): pdb_multi.o - $(CC) -shared -o $@ $^ + $(CC) -shared -o $@ $^ $(TALLOC_LIBS) Makefile: Makefile.in config.status ./config.status Modified: branches/pdbsql_34/configure.in =================================================================== --- branches/pdbsql_34/configure.in 2009-08-03 21:24:03 UTC (rev 166) +++ branches/pdbsql_34/configure.in 2009-08-04 17:47:28 UTC (rev 167) @@ -32,17 +32,17 @@ fi ]) -if test -f "$SOURCEDIR/source/dynconfig.c"; then - SOURCEDIR="$SOURCEDIR/source" +if test -f "$SOURCEDIR/source3/dynconfig.c"; then + SOURCEDIR="$SOURCEDIR" else if test -f "$SOURCEDIR/dynconfig.c"; then - SOURCEDIR="$SOURCEDIR" + SOURCEDIR="$SOURCEDIR/.." else AC_MSG_ERROR([Unable to find Samba sources in $SOURCEDIR. Please specify correct value to --with-samba-dir=]) fi fi if test -z "$LIBDIR"; then - prefix=`grep "^prefix=" $SOURCEDIR/Makefile | cut -d = -f 2` + prefix=`grep "^prefix=" $SOURCEDIR/source3/Makefile | cut -d = -f 2` LIBDIR="$prefix/lib" fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-08-03 21:24:31
|
Revision: 166 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=166&view=rev Author: herwinw Date: 2009-08-03 21:24:03 +0000 (Mon, 03 Aug 2009) Log Message: ----------- Replaced True with true and False with false, as stated in the samba coding guidelines (http://git.samba.org/?p=samba.git;a=blob_plain;f=README.Coding;hb=HEAD) Modified Paths: -------------- branches/pdbsql_34/pdb_multi.c branches/pdbsql_34/pdb_mysql.c branches/pdbsql_34/pdb_pgsql.c branches/pdbsql_34/pdb_sql.c Modified: branches/pdbsql_34/pdb_multi.c =================================================================== --- branches/pdbsql_34/pdb_multi.c 2009-07-27 20:53:02 UTC (rev 165) +++ branches/pdbsql_34/pdb_multi.c 2009-08-03 21:24:03 UTC (rev 166) @@ -62,11 +62,11 @@ struct pdb_search *s = state->search[i]; res = s->next_entry(s, entry); - if (res == True) - return True; + if (res == true) + return true; } - return False; + return false; } static void multisam_search_end(struct pdb_search *search) @@ -97,7 +97,7 @@ if (state == NULL) { DEBUG(0, ("Talloc failed\n")); - return False; + return false; } state->acct_flags = acct_flags; @@ -117,7 +117,7 @@ search->private_data = state; search->next_entry = multisam_search_next_entry; search->search_end = multisam_search_end; - return True; + return true; } @@ -140,15 +140,15 @@ short i; struct multisam_data *data; - if (!methods) return False; + if (!methods) return false; data = (struct multisam_data *)methods->private_data; - if (!data) return False; + if (!data) return false; /* 250 tries.. Andrew Bartlett picked the number. */ for (i = 0; *rid == 0 && i < 250; i++) { if (!data->methods[backend]->new_rid(data->methods[backend], rid)) { - return False; + return false; } /* FIXME We need a function to check if a rid is used. if () { @@ -157,24 +157,24 @@ } if (*rid == 0) { - return False; + return false; } - return True; + return true; } #if 0 static bool multisam_search_groups(struct pdb_methods *methods, struct pdb_search *search) { - return False; + return false; } static bool multisam_search_aliases(struct pdb_methods *methods, struct pdb_search *search, const DOM_SID *sid) { - return False; + return false; } static NTSTATUS multisam_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value) @@ -204,18 +204,18 @@ struct multisam_data *data; bool rv; - if (!methods) return False; + if (!methods) return false; data = (struct multisam_data *)methods->private_data; - if (!data) return False; + if (!data) return false; for (i = 0; i < data->num_backends; i++) { rv = data->methods[i]->uid_to_rid(data->methods[i], uid, rid); - if (rv == True) { - return True; + if (rv == true) { + return true; } } - return False; + return false; } /* Tries gid_to_sid on every backend until one succeeds, returns true on success */ @@ -226,18 +226,18 @@ struct multisam_data *data; bool rv; - if (!methods) return False; + if (!methods) return false; data = (struct multisam_data *)methods->private_data; - if (!data) return False; + if (!data) return false; for (i = 0; i < data->num_backends; i++) { rv = data->methods[i]->gid_to_sid(data->methods[i], gid, sid); - if (rv == True) { - return True; + if (rv == true) { + return true; } } - return False; + return false; } /* Tries sid_to_id on every backend until one succeeds, returns true on success */ @@ -249,18 +249,18 @@ struct multisam_data *data; bool rv; - if (!methods) return False; + if (!methods) return false; data = (struct multisam_data *)methods->private_data; - if (!data) return False; + if (!data) return false; for (i = 0; i < data->num_backends; i++) { rv = data->methods[i]->sid_to_id(data->methods[i], sid, id, type); - if (rv == True) { - return True; + if (rv == true) { + return true; } } - return False; + return false; } #if 0 @@ -735,13 +735,13 @@ /* The rid algorithm of the first backend is used. */ static bool multisam_rid_algorithm (struct pdb_methods *methods) { - return True; + return true; } /* This function is a fallback for errors */ static bool multisam_dummy_new_rid (struct pdb_methods *methods, uint32 *rid) { DEBUG(0, ("This function should not be used!\n")); - return False; + return false; } static NTSTATUS multisam_init(struct pdb_methods **pdb_method, const char *location) Modified: branches/pdbsql_34/pdb_mysql.c =================================================================== --- branches/pdbsql_34/pdb_mysql.c 2009-07-27 20:53:02 UTC (rev 165) +++ branches/pdbsql_34/pdb_mysql.c 2009-08-03 21:24:03 UTC (rev 166) @@ -102,7 +102,7 @@ /* [SYN] Reconnect */ if (!NT_STATUS_IS_OK(pdb_mysql_connect(data))) { DEBUG(0, ("Error: Lost connection to MySQL server\n")); - return False; + return false; } /* [SYN] Retry */ res = mysql_query(data->handle, query); @@ -116,7 +116,7 @@ } *mysql_ret = res; - return True; + return true; } static NTSTATUS row_to_sam_account(MYSQL_RES * r, struct samu * u) @@ -231,11 +231,11 @@ return NT_STATUS_INVALID_PARAMETER; } - query = sql_account_query_select(mem_ctx, data->location, True, field, esc_sname); + query = sql_account_query_select(mem_ctx, data->location, true, field, esc_sname); talloc_free(esc_sname); - if (pdb_mysql_query(data, query, &mysql_ret) == False) + if (pdb_mysql_query(data, query, &mysql_ret) == false) { talloc_free(query); talloc_free(mem_ctx); @@ -349,7 +349,7 @@ talloc_free(esc); - if (pdb_mysql_query(data, query, &mysql_ret) == False) + if (pdb_mysql_query(data, query, &mysql_ret) == false) { talloc_free(query); talloc_free(mem_ctx); @@ -387,7 +387,7 @@ return NT_STATUS_OK; - if (pdb_mysql_query(data, query, &mysql_ret) == False) + if (pdb_mysql_query(data, query, &mysql_ret) == false) { talloc_free(query); return NT_STATUS_UNSUCCESSFUL; @@ -409,10 +409,10 @@ } static bool mysqlsam_rid_algorithm (struct pdb_methods *pdb_methods) { - return True; + return true; } static bool mysqlsam_new_rid (struct pdb_methods *pdb_methods, uint32 *rid) { - return False; + return false; } struct mysqlsam_search_state { @@ -490,12 +490,12 @@ state->acct_flags = acct_flags; - query = sql_account_query_select(NULL, data->location, False, SQL_SEARCH_NONE, NULL); + query = sql_account_query_select(NULL, data->location, false, SQL_SEARCH_NONE, NULL); - if (pdb_mysql_query(data, query, &mysql_ret) == False) + if (pdb_mysql_query(data, query, &mysql_ret) == false) { talloc_free(query); - return False; + return false; } talloc_free(query); Modified: branches/pdbsql_34/pdb_pgsql.c =================================================================== --- branches/pdbsql_34/pdb_pgsql.c 2009-07-27 20:53:02 UTC (rev 165) +++ branches/pdbsql_34/pdb_pgsql.c 2009-08-03 21:24:03 UTC (rev 166) @@ -277,7 +277,7 @@ /* tmp_sname = smb_xstrdup(sname); */ PQescapeString(esc, sname, strlen(sname)); - query = sql_account_query_select(NULL, data->location, True, field, esc); + query = sql_account_query_select(NULL, data->location, true, field, esc); result = pdb_pgsql_query(data, query); /* Result? */ @@ -444,15 +444,15 @@ static bool pgsqlsam_rid_algorithm(struct pdb_methods *pdb_methods) { - return True; + return true; } static bool pgsqlsam_new_rid(struct pdb_methods *pdb_methods, uint32 *rid) { - return False; + return false; } /* Iterate through search results, if a new entry is available: store in - * entry and return True. Otherwise: return False + * entry and return true. Otherwise: return false */ static bool pgsqlsam_search_next_entry(struct pdb_search *search, struct samr_displayentry *entry) @@ -468,12 +468,12 @@ if (r == NULL) { DEBUG(0, ("invalid query result pointer\n")); - return False; + return false; } if (row >= PQntuples(r)) { /* We've reached the end */ - return False; + return false; } /* Now why do we need to fill entry as rid is enough? Okay, it is a bit @@ -494,7 +494,7 @@ if ((entry->account_name == NULL)) { DEBUG(0, ("talloc_strdup failed\n")); - return False; + return false; } if ((entry->acct_flags & search_state->acct_flags) != search_state->acct_flags) { @@ -502,7 +502,7 @@ } - return True; + return true; } /* Free the memory after a search, reset some default values */ @@ -537,18 +537,18 @@ search_state = TALLOC_ZERO_P(search, struct pdb_pgsql_search_state); if (search_state == NULL) { DEBUG(0, ("talloc failed\n")); - return False; + return false; } search_state->acct_flags = acct_flags; if (!pdb_methods) { DEBUG(0, ("invalid methods!\n")); - return False; + return false; } /* The query to select all the users */ - query = sql_account_query_select(NULL, data->location, False, SQL_SEARCH_NONE, NULL); + query = sql_account_query_select(NULL, data->location, false, SQL_SEARCH_NONE, NULL); search_state->pwent = pdb_pgsql_query(data, query); search_state->currow = 0; @@ -556,7 +556,7 @@ /* Check results */ if (search_state->pwent == NULL) { - return False; + return false; } else { DEBUG(5, ("pgsqlsam_search_users succeeded(%d results)!\n", PQntuples(search_state->pwent))); } @@ -564,7 +564,7 @@ search->next_entry = pgsqlsam_search_next_entry; search->search_end = pgsqlsam_search_end; - return True; + return true; } static NTSTATUS pgsqlsam_init (struct pdb_methods **pdb_method, const char *location) Modified: branches/pdbsql_34/pdb_sql.c =================================================================== --- branches/pdbsql_34/pdb_sql.c 2009-07-27 20:53:02 UTC (rev 165) +++ branches/pdbsql_34/pdb_sql.c 2009-08-03 21:24:03 UTC (rev 166) @@ -603,8 +603,8 @@ if(!strcmp(sid_column,"NULL") || !strcmp(username_column, "NULL")) { DEBUG(0,("Please specify both a valid 'user sid column' and a valid 'username column' in smb.conf\n")); - return False; + return false; } - return True; + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-07-27 20:53:36
|
Revision: 165 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=165&view=rev Author: herwinw Date: 2009-07-27 20:53:02 +0000 (Mon, 27 Jul 2009) Log Message: ----------- Slight changes to compile against Samba 3.4 WARNING: It compiles, but has not been tested in *any* way. Use at your own risk. It might work, it might crash Modified Paths: -------------- branches/pdbsql_34/pdb_multi.c branches/pdbsql_34/pdb_mysql.c branches/pdbsql_34/pdb_pgsql.c Modified: branches/pdbsql_34/pdb_multi.c =================================================================== --- branches/pdbsql_34/pdb_multi.c 2009-07-20 20:32:50 UTC (rev 164) +++ branches/pdbsql_34/pdb_multi.c 2009-07-27 20:53:02 UTC (rev 165) @@ -93,7 +93,7 @@ int i; data = (struct multisam_data *) methods->private_data; - state = TALLOC_ZERO_P(search->mem_ctx, struct multisam_search_state); + state = talloc_zero(search, struct multisam_search_state); if (state == NULL) { DEBUG(0, ("Talloc failed\n")); @@ -831,7 +831,7 @@ data->location = talloc_strdup(data, location); data->names = str_list_make(data, data->location, NULL); - data->num_backends = str_list_count((const char **)data->names); + data->num_backends = str_list_length((const char **)data->names); data->locations = talloc_array(data, char *, data->num_backends); data->methods = talloc_array(data, struct pdb_methods *, data->num_backends); Modified: branches/pdbsql_34/pdb_mysql.c =================================================================== --- branches/pdbsql_34/pdb_mysql.c 2009-07-20 20:32:50 UTC (rev 164) +++ branches/pdbsql_34/pdb_mysql.c 2009-07-27 20:53:02 UTC (rev 165) @@ -443,9 +443,9 @@ } entry->acct_flags = atoi(row[23]); - entry->account_name = talloc_strdup(search->mem_ctx,row[6]); - entry->fullname = talloc_strdup(search->mem_ctx,row[9]); - entry->description = talloc_strdup(search->mem_ctx,row[14]); + entry->account_name = talloc_strdup(search, row[6]); + entry->fullname = talloc_strdup(search, row[9]); + entry->description = talloc_strdup(search, row[14]); state->current += 1; @@ -482,7 +482,7 @@ int mysql_ret; struct mysqlsam_search_state *state; - state = TALLOC_ZERO_P(search->mem_ctx, struct mysqlsam_search_state); + state = TALLOC_ZERO_P(search, struct mysqlsam_search_state); if (state == NULL) { DEBUG(0, ("talloc failed\n")); return false; Modified: branches/pdbsql_34/pdb_pgsql.c =================================================================== --- branches/pdbsql_34/pdb_pgsql.c 2009-07-20 20:32:50 UTC (rev 164) +++ branches/pdbsql_34/pdb_pgsql.c 2009-07-27 20:53:02 UTC (rev 165) @@ -486,9 +486,9 @@ } entry->acct_flags = atoi(PQgetvalue(r, row, 23)); - entry->account_name = talloc_strdup(search->mem_ctx, PQgetvalue(r, row, 6)); - entry->fullname = talloc_strdup(search->mem_ctx, PQgetvalue(r, row, 9)); - entry->description = talloc_strdup(search->mem_ctx, PQgetvalue(r, row, 14)); + entry->account_name = talloc_strdup(search, PQgetvalue(r, row, 6)); + entry->fullname = talloc_strdup(search, PQgetvalue(r, row, 9)); + entry->description = talloc_strdup(search, PQgetvalue(r, row, 14)); search_state->currow++; @@ -534,7 +534,7 @@ data = (struct pdb_pgsql_data *) pdb_methods->private_data; - search_state = TALLOC_ZERO_P(search->mem_ctx, struct pdb_pgsql_search_state); + search_state = TALLOC_ZERO_P(search, struct pdb_pgsql_search_state); if (search_state == NULL) { DEBUG(0, ("talloc failed\n")); return False; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-07-20 20:33:22
|
Revision: 164 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=164&view=rev Author: herwinw Date: 2009-07-20 20:32:50 +0000 (Mon, 20 Jul 2009) Log Message: ----------- * Added branch for samba 3.4 plugin. (WARNING: does not compile yet, probably some functions have been renamed) * Updated include-path for Makefile. Removed duplicate entries. Updated entries for the new Samba 3.4 code layout. Removed legacy entries Modified Paths: -------------- branches/pdbsql_34/Makefile.in Added Paths: ----------- branches/pdbsql_34/ Modified: branches/pdbsql_34/Makefile.in =================================================================== --- branches/pdbsql_32-test/Makefile.in 2008-12-20 12:40:51 UTC (rev 163) +++ branches/pdbsql_34/Makefile.in 2009-07-20 20:32:50 UTC (rev 164) @@ -11,7 +11,7 @@ PGSQL_LIBS = @PGSQL_LIBS@ SOURCEDIR = @SOURCEDIR@ LIBDIR = @LIBDIR@ -CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc -I$(SOURCEDIR)/lib/tdb/include -I$(SOURCEDIR)/lib/talloc +CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/librpc -I$(SOURCEDIR)/../lib/replace -I$(SOURCEDIR)/../lib/tdb/include -I$(SOURCEDIR)/../lib/tevent -I$(SOURCEDIR)/.. all: $(addsuffix .$(SHLIBEXT), $(modules)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2008-12-20 12:41:13
|
Revision: 163 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=163&view=rev Author: herwinw Date: 2008-12-20 12:40:51 +0000 (Sat, 20 Dec 2008) Log Message: ----------- Debian-compliant make-configure, we can now create lintian qualified packages Modified Paths: -------------- branches/pdbsql_32-test/Makefile.in branches/pdbsql_32-test/debian/changelog branches/pdbsql_32-test/debian/control branches/pdbsql_32-test/debian/rules branches/pdbsql_32-test/docs/Makefile Added Paths: ----------- branches/pdbsql_32-test/docs/pdb_mysql.html branches/pdbsql_32-test/docs/pdb_pgsql.html Removed Paths: ------------- branches/pdbsql_32-test/docs/pdb_mysql.xml Modified: branches/pdbsql_32-test/Makefile.in =================================================================== --- branches/pdbsql_32-test/Makefile.in 2008-08-12 20:12:28 UTC (rev 162) +++ branches/pdbsql_32-test/Makefile.in 2008-12-20 12:40:51 UTC (rev 163) @@ -11,7 +11,7 @@ PGSQL_LIBS = @PGSQL_LIBS@ SOURCEDIR = @SOURCEDIR@ LIBDIR = @LIBDIR@ -CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc +CFLAGS = -Wall @CFLAGS@ -I$(SOURCEDIR) -I$(SOURCEDIR)/include -I$(SOURCEDIR)/ubiqx -I$(SOURCEDIR)/popt -I$(SOURCEDIR)/lib/replace -I$(SOURCEDIR)/tdb/include -I$(SOURCEDIR)/librpc -I$(SOURCEDIR)/lib/tdb/include -I$(SOURCEDIR)/lib/talloc all: $(addsuffix .$(SHLIBEXT), $(modules)) Modified: branches/pdbsql_32-test/debian/changelog =================================================================== --- branches/pdbsql_32-test/debian/changelog 2008-08-12 20:12:28 UTC (rev 162) +++ branches/pdbsql_32-test/debian/changelog 2008-12-20 12:40:51 UTC (rev 163) @@ -1,5 +1,12 @@ +samba-pdbsql (0.04) UNRELEASED; urgency=low + + * Compatible with Samba 3.2.0 + * Some more things, TODO + + -- Herwin Weststrate <he...@sn...> Tue, 19 Aug 2008 23:48:28 +0200 + samba-pdbsql (0.01) UNRELEASED; urgency=low - * Initial release. (Closes: #XXXXXX) + * Initial release. -- Jelmer Vernooij <je...@sa...> Tue, 21 Mar 2006 01:11:31 +0100 Modified: branches/pdbsql_32-test/debian/control =================================================================== --- branches/pdbsql_32-test/debian/control 2008-08-12 20:12:28 UTC (rev 162) +++ branches/pdbsql_32-test/debian/control 2008-12-20 12:40:51 UTC (rev 163) @@ -7,21 +7,21 @@ Package: samba-pdb-mysql Architecture: any -Depends: ${shlibs:Depends}, samba +Depends: ${shlibs:Depends}, samba (>= 3.2.0) Description: MySQL user database support for Samba This package adds support for storing Samba user information in MySQL. Package: samba-pdb-pgsql Architecture: any -Depends: ${shlibs:Depends}, samba +Depends: ${shlibs:Depends}, samba (>= 3.2.0) Description: PostGreSQL user database support for Samba This package adds support for storing Samba user information in PostGreSQL. Package: samba-pdb-multi Architecture: any -Depends: ${shlibs:Depends}, samba +Depends: ${shlibs:Depends}, samba (>= 3.2.0) Description: Support for concurrent user databases in Samba This package adds support to Samba for using multiple 'passdb backends' at the same time. This feature was removed Modified: branches/pdbsql_32-test/debian/rules =================================================================== --- branches/pdbsql_32-test/debian/rules 2008-08-12 20:12:28 UTC (rev 162) +++ branches/pdbsql_32-test/debian/rules 2008-12-20 12:40:51 UTC (rev 163) @@ -25,12 +25,13 @@ $(MAKE) install DESTDIR=`pwd`/debian/tmp LIBDIR=/usr/lib/samba dh_install --sourcedir=`pwd`/debian/tmp dh_installdocs -p samba-pdb-pgsql AUTHORS docs/README - dh_installdocs -p samba-pdb-mysql docs/pdb_mysql.xml AUTHORS docs/README - dh_installdocs -p samba-pdb-multi AUTHORS docs/README + dh_installdocs -p samba-pdb-mysql docs/pdb_mysql.html AUTHORS docs/README + dh_installdocs -p samba-pdb-multi docs/pdb_pgsql.html AUTHORS docs/README dh_installchangelogs -a dh_installexamples -p samba-pdb-mysql docs/smb.conf.mysql docs/mysql.dump dh_installexamples -p samba-pdb-pgsql docs/smb.conf.pgsql docs/pgsql.dump dh_installman -a + dh_strip -a dh_compress -a dh_fixperms -a dh_shlibdeps -a Modified: branches/pdbsql_32-test/docs/Makefile =================================================================== --- branches/pdbsql_32-test/docs/Makefile 2008-08-12 20:12:28 UTC (rev 162) +++ branches/pdbsql_32-test/docs/Makefile 2008-12-20 12:40:51 UTC (rev 163) @@ -1,6 +1,6 @@ XMLTO = xmlto -all: pdb_mysql.html +all: pdb_mysql.html pdb_pgsql.html %.html: %.xml $(XMLTO) html-nochunks $< Added: branches/pdbsql_32-test/docs/pdb_mysql.html =================================================================== --- branches/pdbsql_32-test/docs/pdb_mysql.html (rev 0) +++ branches/pdbsql_32-test/docs/pdb_mysql.html 2008-12-20 12:40:51 UTC (rev 163) @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> + +<article> + <title>MySQL Password Database backend</title> + <articleinfo> + <author> + <firstname>Jelmer</firstname> + <surname>Vernooij</surname> + <affiliation><orgname>Samba Team</orgname> + <address><email>je...@sa...</email></address> + </affiliation> + </author> + </articleinfo> + +<section> +<title>Creating the Database</title> + +<para> +You can set up your own table and specify the field names to pdb_mysql (see +<link linkend="moremysqlpdbe">MySQL field names for MySQL passdb backend</link> for +the column names) or use the default table. The file + <filename>examples/pdb/mysql/mysql.dump</filename> contains the correct queries to + create the required tables. Use the command: +<screen> + <prompt># </prompt><userinput>mysql -u<replaceable>username</replaceable> -h<replaceable>hostname</replaceable> -p<replaceable>password</replaceable> \ + <replaceable>databasename</replaceable> < <filename>/path/to/samba/examples/pdb/mysql/mysql.dump</filename></userinput> +</screen> + </para> +</section> + +<section> + <title>Configuring</title> + + <para>This plug-in lacks some good documentation, but here is some brief information. Add the following to the + <parameter>passdb backend</parameter> variable in your <filename>smb.conf</filename>: +<programlisting> +passdb backend = [other-plugins] mysql:identifier [other-plugins] +</programlisting> + </para> + + <para>The identifier can be any string you like, as long as it does not collide with + the identifiers of other plugins or other instances of pdb_mysql. If you + specify multiple pdb_mysql.so entries in <parameter>passdb backend</parameter>, you also need to + use different identifiers. + </para> + + <para> + Additional options can be given through the <filename>smb.conf</filename> file in the <parameter>[global]</parameter> section. + Refer to <link linkend="mysqlpbe">Basic smb.conf Options for MySQL passdb Backend</link>. + </para> + + <table frame="all" id="mysqlpbe"> + <title>Basic smb.conf Options for MySQL passdb Backend</title> + <tgroup cols="2"> + <colspec align="left"/> + <colspec align="justify" colwidth="1*"/> + <thead> + <row><entry>Field</entry><entry>Contents</entry></row> + </thead> + <tbody> + <row><entry>mysql host</entry><entry>Host name, defaults to `localhost'</entry></row> + <row><entry>mysql password</entry><entry></entry></row> + <row><entry>mysql user</entry><entry>Defaults to `samba'</entry></row> + <row><entry>mysql database</entry><entry>Defaults to `samba'</entry></row> + <row><entry>mysql port</entry><entry>Defaults to 3306</entry></row> + <row><entry>table</entry><entry>Name of the table containing the users</entry></row> + </tbody> + </tgroup> + </table> + + <warning> + <para> + Since the password for the MySQL user is stored in the <filename>smb.conf</filename> file, you should make the <filename>smb.conf</filename> file + readable only to the user who runs Samba. This is considered a security bug and will soon be fixed. + </para> + </warning> + + <para>Names of the columns are given in <link linkend="moremysqlpdbe">MySQL field names for MySQL + passdb backend</link>. The default column names can be found in the example table dump. + </para> + +<para> + <table frame="all" id="moremysqlpdbe"> + <title>MySQL field names for MySQL passdb backend</title> + <tgroup cols="3" align="justify"> + <colspec align="left"/> + <colspec align="left"/> + <colspec align="justify" colwidth="1*"/> + <thead> + <row><entry>Field</entry><entry>Type</entry><entry>Contents</entry></row> + </thead> + <tbody> + <row><entry>logon time column</entry><entry>int(9)</entry><entry>UNIX timestamp of last logon of user</entry></row> + <row><entry>logoff time column</entry><entry>int(9)</entry><entry>UNIX timestamp of last logoff of user</entry></row> + <row><entry>kickoff time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment user should be kicked off workstation (not enforced)</entry></row> + <row><entry>pass last set time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment password was last set</entry></row> + <row><entry>pass can change time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment from which password can be changed</entry></row> + <row><entry>pass must change time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment on which password must be changed</entry></row> + <row><entry>username column</entry><entry>varchar(255)</entry><entry>UNIX username</entry></row> + <row><entry>domain column</entry><entry>varchar(255)</entry><entry>NT domain user belongs to</entry></row> + <row><entry>nt username column</entry><entry>varchar(255)</entry><entry>NT username</entry></row> + <row><entry>fullname column</entry><entry>varchar(255)</entry><entry>Full name of user</entry></row> + <row><entry>home dir column</entry><entry>varchar(255)</entry><entry>UNIX homedir path (equivalent of the <parameter>logon home</parameter> parameter.</entry></row> + <row><entry>dir drive column</entry><entry>varchar(2)</entry><entry>Directory drive path (e.g., <quote>H:</quote>)</entry></row> + <row><entry>logon script column</entry><entry>varchar(255)</entry><entry>Batch file to run on client side when logging on</entry></row> + <row><entry>profile path column</entry><entry>varchar(255)</entry><entry>Path of profile</entry></row> + <row><entry>acct desc column</entry><entry>varchar(255)</entry><entry>Some ASCII NT user data</entry></row> + <row><entry>workstations column</entry><entry>varchar(255)</entry><entry>Workstations user can logon to (or NULL for all)</entry></row> + <row><entry>unknown string column</entry><entry>varchar(255)</entry><entry>Unknown string</entry></row> + <row><entry>munged dial column</entry><entry>varchar(255)</entry><entry>Unknown</entry></row> + <row><entry>user sid column</entry><entry>varchar(255)</entry><entry>NT user SID</entry></row> + <row><entry>group sid column</entry><entry>varchar(255)</entry><entry>NT group SID</entry></row> + <row><entry>lanman pass column</entry><entry>varchar(255)</entry><entry>Encrypted lanman password</entry></row> + <row><entry>nt pass column</entry><entry>varchar(255)</entry><entry>Encrypted nt passwd</entry></row> + <row><entry>plain pass column</entry><entry>varchar(255)</entry><entry>Plaintext password</entry></row> + <row><entry>acct ctrl column</entry><entry>int(9)</entry><entry>NT user data</entry></row> + <row><entry>unknown 3 column</entry><entry>int(9)</entry><entry>Unknown</entry></row> + <row><entry>logon divs column</entry><entry>int(9)</entry><entry>Unknown</entry></row> + <row><entry>hours len column</entry><entry>int(9)</entry><entry>Unknown</entry></row> + <row><entry>bad password count column</entry><entry>int(5)</entry><entry>Number of failed password tries before disabling an account</entry></row> + <row><entry>logon count column</entry><entry>int(5)</entry><entry>Number of logon attempts</entry></row> + <row><entry>unknown 6 column</entry><entry>int(9)</entry><entry>Unknown</entry></row> + </tbody></tgroup> +</table> +</para> + + <para> + You can put a colon (:) after the name of each column, which + should specify the column to update when updating the table. You can also specify nothing behind the colon, in which case the field data will not be updated. Setting a column name to <parameter>NULL</parameter> means the field should not be used. + </para> + + <para><link linkend="mysqlsam">An example configuration</link> is shown in <link + linkend="mysqlsam">Example Configuration for the MySQL passdb Backend</link>. + </para> + + <example id="mysqlsam"> + <title>Example Configuration for the MySQL passdb Backend</title> + + <programlisting> +[global] +passdb backend = mysql:foo +foo:mysql user = samba +foo:mysql password = abmas +foo:mysql database = samba +# domain name is static and can't be changed +foo:domain column = 'MYWORKGROUP': +# The fullname column comes from several other columns +foo:fullname column = CONCAT(firstname,' ',surname): +# Samba should never write to the password columns +foo:lanman pass column = lm_pass: +foo:nt pass column = nt_pass: +# The unknown 3 column is not stored +foo:unknown 3 column = NULL +</programlisting> + </example> +</section> + +<section> +<title>Using Plaintext Passwords or Encrypted Password</title> + + <para> + The use of plaintext passwords is strongly discouraged; however, you can use them if you really want to. + </para> + + <para> + If you would like to use plaintext passwords, set + `identifier:lanman pass column' and `identifier:nt pass column' to + `NULL' (without the quotes) and `identifier:plain pass column' to the + name of the column containing the plaintext passwords. + </para> + + <para> + If you use encrypted passwords, set the 'identifier:plain pass + column' to 'NULL' (without the quotes). This is the default. + </para> + +</section> + +<section> +<title>Getting Non-Column Data from the Table</title> + + <para> + It is possible to have not all data in the database by making some "constant." + </para> + + <para> + For example, you can set `identifier:fullname column' to + something like <command>CONCAT(Firstname,' ',Surname)</command> + </para> + + <para> + Or, set `identifier:workstations column' to: + <command>NULL</command>.</para> + + <para>See the MySQL documentation for more language constructs.</para> +</section> +</article> Deleted: branches/pdbsql_32-test/docs/pdb_mysql.xml =================================================================== --- branches/pdbsql_32-test/docs/pdb_mysql.xml 2008-08-12 20:12:28 UTC (rev 162) +++ branches/pdbsql_32-test/docs/pdb_mysql.xml 2008-12-20 12:40:51 UTC (rev 163) @@ -1,198 +0,0 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> - -<article> - <title>MySQL Password Database backend</title> - <articleinfo> - <author> - <firstname>Jelmer</firstname> - <surname>Vernooij</surname> - <affiliation><orgname>Samba Team</orgname> - <address><email>je...@sa...</email></address> - </affiliation> - </author> - </articleinfo> - -<section> -<title>Creating the Database</title> - -<para> -You can set up your own table and specify the field names to pdb_mysql (see -<link linkend="moremysqlpdbe">MySQL field names for MySQL passdb backend</link> for -the column names) or use the default table. The file - <filename>examples/pdb/mysql/mysql.dump</filename> contains the correct queries to - create the required tables. Use the command: -<screen> - <prompt># </prompt><userinput>mysql -u<replaceable>username</replaceable> -h<replaceable>hostname</replaceable> -p<replaceable>password</replaceable> \ - <replaceable>databasename</replaceable> < <filename>/path/to/samba/examples/pdb/mysql/mysql.dump</filename></userinput> -</screen> - </para> -</section> - -<section> - <title>Configuring</title> - - <para>This plug-in lacks some good documentation, but here is some brief information. Add the following to the - <parameter>passdb backend</parameter> variable in your <filename>smb.conf</filename>: -<programlisting> -passdb backend = [other-plugins] mysql:identifier [other-plugins] -</programlisting> - </para> - - <para>The identifier can be any string you like, as long as it does not collide with - the identifiers of other plugins or other instances of pdb_mysql. If you - specify multiple pdb_mysql.so entries in <parameter>passdb backend</parameter>, you also need to - use different identifiers. - </para> - - <para> - Additional options can be given through the <filename>smb.conf</filename> file in the <parameter>[global]</parameter> section. - Refer to <link linkend="mysqlpbe">Basic smb.conf Options for MySQL passdb Backend</link>. - </para> - - <table frame="all" id="mysqlpbe"> - <title>Basic smb.conf Options for MySQL passdb Backend</title> - <tgroup cols="2"> - <colspec align="left"/> - <colspec align="justify" colwidth="1*"/> - <thead> - <row><entry>Field</entry><entry>Contents</entry></row> - </thead> - <tbody> - <row><entry>mysql host</entry><entry>Host name, defaults to `localhost'</entry></row> - <row><entry>mysql password</entry><entry></entry></row> - <row><entry>mysql user</entry><entry>Defaults to `samba'</entry></row> - <row><entry>mysql database</entry><entry>Defaults to `samba'</entry></row> - <row><entry>mysql port</entry><entry>Defaults to 3306</entry></row> - <row><entry>table</entry><entry>Name of the table containing the users</entry></row> - </tbody> - </tgroup> - </table> - - <warning> - <para> - Since the password for the MySQL user is stored in the <filename>smb.conf</filename> file, you should make the <filename>smb.conf</filename> file - readable only to the user who runs Samba. This is considered a security bug and will soon be fixed. - </para> - </warning> - - <para>Names of the columns are given in <link linkend="moremysqlpdbe">MySQL field names for MySQL - passdb backend</link>. The default column names can be found in the example table dump. - </para> - -<para> - <table frame="all" id="moremysqlpdbe"> - <title>MySQL field names for MySQL passdb backend</title> - <tgroup cols="3" align="justify"> - <colspec align="left"/> - <colspec align="left"/> - <colspec align="justify" colwidth="1*"/> - <thead> - <row><entry>Field</entry><entry>Type</entry><entry>Contents</entry></row> - </thead> - <tbody> - <row><entry>logon time column</entry><entry>int(9)</entry><entry>UNIX timestamp of last logon of user</entry></row> - <row><entry>logoff time column</entry><entry>int(9)</entry><entry>UNIX timestamp of last logoff of user</entry></row> - <row><entry>kickoff time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment user should be kicked off workstation (not enforced)</entry></row> - <row><entry>pass last set time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment password was last set</entry></row> - <row><entry>pass can change time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment from which password can be changed</entry></row> - <row><entry>pass must change time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment on which password must be changed</entry></row> - <row><entry>username column</entry><entry>varchar(255)</entry><entry>UNIX username</entry></row> - <row><entry>domain column</entry><entry>varchar(255)</entry><entry>NT domain user belongs to</entry></row> - <row><entry>nt username column</entry><entry>varchar(255)</entry><entry>NT username</entry></row> - <row><entry>fullname column</entry><entry>varchar(255)</entry><entry>Full name of user</entry></row> - <row><entry>home dir column</entry><entry>varchar(255)</entry><entry>UNIX homedir path (equivalent of the <parameter>logon home</parameter> parameter.</entry></row> - <row><entry>dir drive column</entry><entry>varchar(2)</entry><entry>Directory drive path (e.g., <quote>H:</quote>)</entry></row> - <row><entry>logon script column</entry><entry>varchar(255)</entry><entry>Batch file to run on client side when logging on</entry></row> - <row><entry>profile path column</entry><entry>varchar(255)</entry><entry>Path of profile</entry></row> - <row><entry>acct desc column</entry><entry>varchar(255)</entry><entry>Some ASCII NT user data</entry></row> - <row><entry>workstations column</entry><entry>varchar(255)</entry><entry>Workstations user can logon to (or NULL for all)</entry></row> - <row><entry>unknown string column</entry><entry>varchar(255)</entry><entry>Unknown string</entry></row> - <row><entry>munged dial column</entry><entry>varchar(255)</entry><entry>Unknown</entry></row> - <row><entry>user sid column</entry><entry>varchar(255)</entry><entry>NT user SID</entry></row> - <row><entry>group sid column</entry><entry>varchar(255)</entry><entry>NT group SID</entry></row> - <row><entry>lanman pass column</entry><entry>varchar(255)</entry><entry>Encrypted lanman password</entry></row> - <row><entry>nt pass column</entry><entry>varchar(255)</entry><entry>Encrypted nt passwd</entry></row> - <row><entry>plain pass column</entry><entry>varchar(255)</entry><entry>Plaintext password</entry></row> - <row><entry>acct ctrl column</entry><entry>int(9)</entry><entry>NT user data</entry></row> - <row><entry>unknown 3 column</entry><entry>int(9)</entry><entry>Unknown</entry></row> - <row><entry>logon divs column</entry><entry>int(9)</entry><entry>Unknown</entry></row> - <row><entry>hours len column</entry><entry>int(9)</entry><entry>Unknown</entry></row> - <row><entry>bad password count column</entry><entry>int(5)</entry><entry>Number of failed password tries before disabling an account</entry></row> - <row><entry>logon count column</entry><entry>int(5)</entry><entry>Number of logon attempts</entry></row> - <row><entry>unknown 6 column</entry><entry>int(9)</entry><entry>Unknown</entry></row> - </tbody></tgroup> -</table> -</para> - - <para> - You can put a colon (:) after the name of each column, which - should specify the column to update when updating the table. You can also specify nothing behind the colon, in which case the field data will not be updated. Setting a column name to <parameter>NULL</parameter> means the field should not be used. - </para> - - <para><link linkend="mysqlsam">An example configuration</link> is shown in <link - linkend="mysqlsam">Example Configuration for the MySQL passdb Backend</link>. - </para> - - <example id="mysqlsam"> - <title>Example Configuration for the MySQL passdb Backend</title> - - <programlisting> -[global] -passdb backend = mysql:foo -foo:mysql user = samba -foo:mysql password = abmas -foo:mysql database = samba -# domain name is static and can't be changed -foo:domain column = 'MYWORKGROUP': -# The fullname column comes from several other columns -foo:fullname column = CONCAT(firstname,' ',surname): -# Samba should never write to the password columns -foo:lanman pass column = lm_pass: -foo:nt pass column = nt_pass: -# The unknown 3 column is not stored -foo:unknown 3 column = NULL -</programlisting> - </example> -</section> - -<section> -<title>Using Plaintext Passwords or Encrypted Password</title> - - <para> - The use of plaintext passwords is strongly discouraged; however, you can use them if you really want to. - </para> - - <para> - If you would like to use plaintext passwords, set - `identifier:lanman pass column' and `identifier:nt pass column' to - `NULL' (without the quotes) and `identifier:plain pass column' to the - name of the column containing the plaintext passwords. - </para> - - <para> - If you use encrypted passwords, set the 'identifier:plain pass - column' to 'NULL' (without the quotes). This is the default. - </para> - -</section> - -<section> -<title>Getting Non-Column Data from the Table</title> - - <para> - It is possible to have not all data in the database by making some "constant." - </para> - - <para> - For example, you can set `identifier:fullname column' to - something like <command>CONCAT(Firstname,' ',Surname)</command> - </para> - - <para> - Or, set `identifier:workstations column' to: - <command>NULL</command>.</para> - - <para>See the MySQL documentation for more language constructs.</para> -</section> -</article> Added: branches/pdbsql_32-test/docs/pdb_pgsql.html =================================================================== --- branches/pdbsql_32-test/docs/pdb_pgsql.html (rev 0) +++ branches/pdbsql_32-test/docs/pdb_pgsql.html 2008-12-20 12:40:51 UTC (rev 163) @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> + +<article> + <title>PostgreSQL Password Database backend</title> + <articleinfo> + <author> + <firstname>Jelmer</firstname> + <surname>Vernooij</surname> + <affiliation><orgname>Samba Team</orgname> + <address><email>je...@sa...</email></address> + </affiliation> + </author> + </articleinfo> + +<section> +<title>Creating the Database</title> + +<para> +You can set up your own table and specify the field names to pdb_pgsql (see +<link linkend="morepgsqlpdbe">PostgreSQL field names for PostgreSQL passdb backend</link> for +the column names) or use the default table. The file + <filename>examples/pdb/pgsql/pgsql.dump</filename> contains the correct queries to + create the required tables. Use the command: +<screen> + <prompt># </prompt><userinput>psql -h <replaceable>hostname</replaceable> -U <replaceable>username</replaceable> -f <filename>/path/to/samba/examples/pdb/pgsql/pgsql.dump</filename></userinput> <replaceable>databasename</replaceable> +</screen> + </para> +</section> + +<section> + <title>Configuring</title> + + <para>This plug-in lacks some good documentation, but here is some brief information. Add the following to the + <parameter>passdb backend</parameter> variable in your <filename>smb.conf</filename>: +<programlisting> +passdb backend = [other-plugins] pgsql:identifier [other-plugins] +</programlisting> + </para> + + <para>The identifier can be any string you like, as long as it does not collide with + the identifiers of other plugins or other instances of pdb_pgsql. If you + specify multiple pdb_pgsql.so entries in <parameter>passdb backend</parameter>, you also need to + use different identifiers. + </para> + + <para> + Additional options can be given through the <filename>smb.conf</filename> file in the <parameter>[global]</parameter> section. + Refer to <link linkend="pgsqlpbe">Basic smb.conf Options for PostgreSQL passdb Backend</link>. + </para> + + <table frame="all" id="pgsqlpbe"> + <title>Basic smb.conf Options for PostgresSQL passdb Backend</title> + <tgroup cols="2"> + <colspec align="left"/> + <colspec align="justify" colwidth="1*"/> + <thead> + <row><entry>Field</entry><entry>Contents</entry></row> + </thead> + <tbody> + <row><entry>pgsql host</entry><entry>Host name, defaults to `localhost'</entry></row> + <row><entry>pgsql password</entry><entry></entry></row> + <row><entry>pgsql user</entry><entry>Defaults to `samba'</entry></row> + <row><entry>pgsql database</entry><entry>Defaults to `samba'</entry></row> + <row><entry>pgsql port</entry><entry>Defaults to 5432</entry></row> + <row><entry>table</entry><entry>Name of the table containing the users</entry></row> + </tbody> + </tgroup> + </table> + + <warning> + <para> + Since the password for the PostgreSQL user is stored in the <filename>smb.conf</filename> file, you should make the <filename>smb.conf</filename> file + readable only to the user who runs Samba. This is considered a security bug and will soon be fixed. + </para> + </warning> + + <para>Names of the columns are given in <link linkend="morepgsqlpdbe">PostgreSQL field names for PostgreSQL + passdb backend</link>. The default column names can be found in the example table dump. + </para> + +<para> + <table frame="all" id="morepgsqlpdbe"> + <title>PostgreSQL field names for PostgreSQL passdb backend</title> + <tgroup cols="3" align="justify"> + <colspec align="left"/> + <colspec align="left"/> + <colspec align="justify" colwidth="1*"/> + <thead> + <row><entry>Field</entry><entry>Type</entry><entry>Contents</entry></row> + </thead> + <tbody> + <row><entry>logon time column</entry><entry>int(9)</entry><entry>UNIX timestamp of last logon of user</entry></row> + <row><entry>logoff time column</entry><entry>int(9)</entry><entry>UNIX timestamp of last logoff of user</entry></row> + <row><entry>kickoff time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment user should be kicked off workstation (not enforced)</entry></row> + <row><entry>pass last set time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment password was last set</entry></row> + <row><entry>pass can change time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment from which password can be changed</entry></row> + <row><entry>pass must change time column</entry><entry>int(9)</entry><entry>UNIX timestamp of moment on which password must be changed</entry></row> + <row><entry>username column</entry><entry>varchar(255)</entry><entry>UNIX username</entry></row> + <row><entry>domain column</entry><entry>varchar(255)</entry><entry>NT domain user belongs to</entry></row> + <row><entry>nt username column</entry><entry>varchar(255)</entry><entry>NT username</entry></row> + <row><entry>fullname column</entry><entry>varchar(255)</entry><entry>Full name of user</entry></row> + <row><entry>home dir column</entry><entry>varchar(255)</entry><entry>UNIX homedir path (equivalent of the <parameter>logon home</parameter> parameter.</entry></row> + <row><entry>dir drive column</entry><entry>varchar(2)</entry><entry>Directory drive path (e.g., <quote>H:</quote>)</entry></row> + <row><entry>logon script column</entry><entry>varchar(255)</entry><entry>Batch file to run on client side when logging on</entry></row> + <row><entry>profile path column</entry><entry>varchar(255)</entry><entry>Path of profile</entry></row> + <row><entry>acct desc column</entry><entry>varchar(255)</entry><entry>Some ASCII NT user data</entry></row> + <row><entry>workstations column</entry><entry>varchar(255)</entry><entry>Workstations user can logon to (or NULL for all)</entry></row> + <row><entry>unknown string column</entry><entry>varchar(255)</entry><entry>Unknown string</entry></row> + <row><entry>munged dial column</entry><entry>varchar(255)</entry><entry>Unknown</entry></row> + <row><entry>user sid column</entry><entry>varchar(255)</entry><entry>NT user SID</entry></row> + <row><entry>group sid column</entry><entry>varchar(255)</entry><entry>NT group SID</entry></row> + <row><entry>lanman pass column</entry><entry>varchar(255)</entry><entry>Encrypted lanman password</entry></row> + <row><entry>nt pass column</entry><entry>varchar(255)</entry><entry>Encrypted nt passwd</entry></row> + <row><entry>plain pass column</entry><entry>varchar(255)</entry><entry>Plaintext password</entry></row> + <row><entry>acct ctrl column</entry><entry>int(9)</entry><entry>NT user data</entry></row> + <row><entry>unknown 3 column</entry><entry>int(9)</entry><entry>Unknown</entry></row> + <row><entry>logon divs column</entry><entry>int(9)</entry><entry>Unknown</entry></row> + <row><entry>hours len column</entry><entry>int(9)</entry><entry>Unknown</entry></row> + <row><entry>bad password count column</entry><entry>int(5)</entry><entry>Number of failed password tries before disabling an account</entry></row> + <row><entry>logon count column</entry><entry>int(5)</entry><entry>Number of logon attempts</entry></row> + <row><entry>unknown 6 column</entry><entry>int(9)</entry><entry>Unknown</entry></row> + </tbody></tgroup> +</table> +</para> + + <para> + You can put a colon (:) after the name of each column, which + should specify the column to update when updating the table. You can also specify nothing behind the colon, in which case the field data will not be updated. Setting a column name to <parameter>NULL</parameter> means the field should not be used. + </para> + + <para><link linkend="pgsqlsam">An example configuration</link> is shown in <link + linkend="pgsqlsam">Example Configuration for the PostgreSQL passdb Backend</link>. + </para> + + <example id="pgsqlsam"> + <title>Example Configuration for the PostgreSQL passdb Backend</title> + + <programlisting> +[global] +passdb backend = pgsql:foo +foo:pgsql user = samba +foo:pgsql password = abmas +foo:pgsql database = samba +# domain name is static and can't be changed +foo:domain column = 'MYWORKGROUP': +# The fullname column comes from several other columns +foo:fullname column = firstname || ' ' || surname: +# Samba should never write to the password columns +foo:lanman pass column = lm_pass: +foo:nt pass column = nt_pass: +# The unknown 3 column is not stored +foo:unknown 3 column = NULL +</programlisting> + </example> +</section> + +<section> +<title>Using Plaintext Passwords or Encrypted Password</title> + + <para> + The use of plaintext passwords is strongly discouraged; however, you can use them if you really want to. + </para> + + <para> + If you would like to use plaintext passwords, set + `identifier:lanman pass column' and `identifier:nt pass column' to + `NULL' (without the quotes) and `identifier:plain pass column' to the + name of the column containing the plaintext passwords. + </para> + + <para> + If you use encrypted passwords, set the 'identifier:plain pass + column' to 'NULL' (without the quotes). This is the default. + </para> + +</section> + +<section> +<title>Getting Non-Column Data from the Table</title> + + <para> + It is possible to have not all data in the database by making some "constant." + </para> + + <para> + For example, you can set `identifier:fullname column' to + something like <command>Firstname || ' ' || Surname</command> + </para> + + <para> + Or, set `identifier:workstations column' to: + <command>NULL</command>.</para> + + <para>See the PostgresSQL documentation for more language constructs.</para> +</section> +</article> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2008-08-12 20:12:18
|
Revision: 162 http://pdbsql.svn.sourceforge.net/pdbsql/?rev=162&view=rev Author: herwinw Date: 2008-08-12 20:12:28 +0000 (Tue, 12 Aug 2008) Log Message: ----------- * Centralized pgsql query execution * Removed distinction between handle and master_handle (haven't seen the assumption that would justify this working) * First reconnection try (but doesn't really work at my system, still WIP) Modified Paths: -------------- branches/pdbsql_32-test/pdb_pgsql.c Modified: branches/pdbsql_32-test/pdb_pgsql.c =================================================================== --- branches/pdbsql_32-test/pdb_pgsql.c 2008-08-12 18:06:55 UTC (rev 161) +++ branches/pdbsql_32-test/pdb_pgsql.c 2008-08-12 20:12:28 UTC (rev 162) @@ -51,7 +51,6 @@ /* handles for doing db transactions */ typedef struct pdb_pgsql_data { - PGconn *master_handle; PGconn *handle; PGresult *pwent; @@ -121,24 +120,37 @@ return handle; } -/* The assumption here is that the master process will get connection 0, - * and all the renaining ones just one connection for their etire life span. - */ -static PGconn *choose_connection(struct pdb_pgsql_data *data) +static PGresult *pdb_pgsql_query(struct pdb_pgsql_data *data, char *query) { - if (data->master_handle == NULL) { - data->master_handle = pgsqlsam_connect(data); - return data->master_handle; - } + PGresult *result; - /* Master connection != NULL, so we are just another process. */ - - /* If we didn't connect yet, do it now. */ + /* Connect to the DB. */ if (data->handle == NULL) { + DEBUG(0, ("Unable to obtain handle, trying to connect\n")); data->handle = pgsqlsam_connect(data); + if (data->handle == NULL) + { + DEBUG(0, ("Failed again, stopping\n")); + return NULL; + } } - return data->handle; + /* Execute query */ + DEBUG(5, ("Executing query %s\n", query)); + result = PQexec(data->handle, query); + + /* Result? */ + if (result == NULL) { + /* Will happen mostly because the server has been disconnected */ + DEBUG(1, ("Error executing %s, %s (trying to recover with reconnect)\n", query, PQerrorMessage(data->handle))); + PQreset(data->handle); + } else if (PQresultStatus(result) != PGRES_TUPLES_OK) { + DEBUG(1, ("Error executing %s, %s\n", query, PQresultErrorMessage(result))); + PQclear(result); + result = NULL; + } + + return result; } static long PQgetlong(PGresult *r, long row, long col) @@ -239,7 +251,6 @@ static NTSTATUS pgsqlsam_select_by_field(struct pdb_methods *methods, struct samu *user, enum sql_search_field field, const char *sname) { struct pdb_pgsql_data *data; - PGconn *handle; char *esc; char *query; @@ -266,36 +277,23 @@ /* tmp_sname = smb_xstrdup(sname); */ PQescapeString(esc, sname, strlen(sname)); - /* Connect to the DB. */ - handle = choose_connection(data); - if (handle == NULL) { - return NT_STATUS_UNSUCCESSFUL; - } - query = sql_account_query_select(NULL, data->location, True, field, esc); + result = pdb_pgsql_query(data, query); - /* Execute query */ - DEBUG(5, ("Executing query %s\n", query)); - result = PQexec(handle, query); - /* Result? */ - if (result == NULL) { - DEBUG(0, ("Error executing %s, %s\n", query, PQerrorMessage(handle))); + if (result == NULL) + { retval = NT_STATUS_UNSUCCESSFUL; - } else if (PQresultStatus(result) != PGRES_TUPLES_OK) { - DEBUG(0, ("Error executing %s, %s\n", query, PQresultErrorMessage(result))); - retval = NT_STATUS_UNSUCCESSFUL; - } else { + } + else + { retval = row_to_sam_account(result, 0, user); + PQclear(result); } talloc_free(esc); talloc_free(query); - if (result != NULL) { - PQclear(result); - } - return retval; } @@ -354,7 +352,6 @@ static NTSTATUS pgsqlsam_delete_sam_account(struct pdb_methods *methods, struct samu *sam_pass) { struct pdb_pgsql_data *data; - PGconn *handle; const char *sname = pdb_get_username(sam_pass); char *esc; @@ -379,30 +376,17 @@ PQescapeString(esc, sname, strlen(sname)); - /* Connect to the DB. */ - handle = choose_connection(data); - if (handle == NULL) { - return NT_STATUS_UNSUCCESSFUL; - } query = sql_account_query_delete(NULL, data->location, esc); + result = pdb_pgsql_query(data, query); - /* Execute query */ - result = PQexec(handle, query); - if (result == NULL) { - DEBUG(0, ("Error executing %s, %s\n", query, PQerrorMessage(handle))); retval = NT_STATUS_UNSUCCESSFUL; - } else if (PQresultStatus(result) != PGRES_COMMAND_OK) { - DEBUG(0, ("Error executing %s, %s\n", query, PQresultErrorMessage(result))); - retval = NT_STATUS_UNSUCCESSFUL; } else { DEBUG(5, ("User '%s' deleted\n", sname)); retval = NT_STATUS_OK; + PQclear(result); } - if (result != NULL) { - PQclear(result); - } talloc_free(esc); talloc_free(query); @@ -412,7 +396,6 @@ static NTSTATUS pgsqlsam_replace_sam_account(struct pdb_methods *methods, struct samu *newpwd, char isupdate) { struct pdb_pgsql_data *data; - PGconn *handle; char *query; PGresult *result; NTSTATUS retval; @@ -434,30 +417,18 @@ /* Nothing to update. */ return NT_STATUS_OK; } - /* Connect to the DB. */ - handle = choose_connection(data); - if (handle == NULL) { - return NT_STATUS_UNSUCCESSFUL; - } /* Execute the query */ - result = PQexec(handle, query); + result = pdb_pgsql_query(data, query); if (result == NULL) { - DEBUG(0, ("Error executing %s, %s\n", query, PQerrorMessage(handle))); retval = NT_STATUS_INVALID_PARAMETER; - } else if (PQresultStatus(result) != PGRES_COMMAND_OK) { - DEBUG(0, ("Error executing %s, %s\n", query, PQresultErrorMessage(result))); - retval = NT_STATUS_INVALID_PARAMETER; } else { + PQclear(result); retval = NT_STATUS_OK; } - if (result != NULL) { - PQclear(result); - } talloc_free(query); - return retval; } @@ -559,7 +530,6 @@ { struct pdb_pgsql_data *data; struct pdb_pgsql_search_state *search_state; - PGconn *handle; char *query; data = (struct pdb_pgsql_data *) pdb_methods->private_data; @@ -576,27 +546,17 @@ return False; } - handle = choose_connection(data); - if (handle == NULL) { - DEBUG(0, ("Unable to obtain handle\n")); - return False; - } /* The query to select all the users */ query = sql_account_query_select(NULL, data->location, False, SQL_SEARCH_NONE, NULL); - DEBUG(5, ("Executing query: %s\n", query)); - search_state->pwent = PQexec(handle, query); + search_state->pwent = pdb_pgsql_query(data, query); search_state->currow = 0; talloc_free(query); /* Check results */ if (search_state->pwent == NULL) { - DEBUG(0, ("Error executing %s, %s\n", query, PQerrorMessage(handle))); return False; - } else if (PQresultStatus(search_state->pwent) != PGRES_TUPLES_OK) { - DEBUG(0, ("Error executing %s, %s\n", query, PQresultErrorMessage(search_state->pwent))); - return False; } else { DEBUG(5, ("pgsqlsam_search_users succeeded(%d results)!\n", PQntuples(search_state->pwent))); } @@ -639,7 +599,6 @@ data = talloc(*pdb_method, struct pdb_pgsql_data); (*pdb_method)->private_data = data; - data->master_handle = NULL; data->handle = NULL; data->pwent = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |