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: Collen B. <co...@ma...> - 2006-06-28 09:34:41
|
Revision: 63 Author: collen Date: 2006-06-28 02:12:05 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=63&view=rev Log Message: ----------- Insert acct_desc insert and update. Modified Paths: -------------- trunk/samba-pdbsql/pdb_sql.c Modified: trunk/samba-pdbsql/pdb_sql.c =================================================================== --- trunk/samba-pdbsql/pdb_sql.c 2006-06-14 20:24:09 UTC (rev 62) +++ trunk/samba-pdbsql/pdb_sql.c 2006-06-28 09:12:05 UTC (rev 63) @@ -325,6 +325,7 @@ CONFIG_ACCT_CTRL_DEFAULT), pdb_get_acct_ctrl(newpwd)); } + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONTIME)) { some_field_affected = 1; @@ -466,6 +467,14 @@ CONFIG_PROFILE_PATH_DEFAULT), pdb_get_profile_path(newpwd)); } +/* acct_desc update [C] */ + 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; @@ -483,6 +492,9 @@ pdb_get_homedir(newpwd)); } + +/* */ + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_WORKSTATIONS)) { some_field_affected = 1; pdb_sql_string_field(query, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-06-14 20:25:09
|
Revision: 62 Author: synnack Date: 2006-06-14 13:24:09 -0700 (Wed, 14 Jun 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=62&view=rev Log Message: ----------- Release 0.1 for samba 3.0.23 (or any pre-release/release candidate thereof) Added Paths: ----------- tags/pdbsql-0.1-samba_3.0.23/ Copied: tags/pdbsql-0.1-samba_3.0.23 (from rev 61, trunk/samba-pdbsql) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ctr...@us...> - 2006-03-27 11:12:15
|
Revision: 61 Author: ctrlsoft Date: 2006-03-27 03:12:08 -0800 (Mon, 27 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=61&view=rev Log Message: ----------- Add package for multisam Modified Paths: -------------- trunk/samba-pdbsql/debian/control trunk/samba-pdbsql/debian/rules Added Paths: ----------- trunk/samba-pdbsql/debian/samba-pdb-multi.install Modified: trunk/samba-pdbsql/debian/control =================================================================== --- trunk/samba-pdbsql/debian/control 2006-03-26 14:00:44 UTC (rev 60) +++ trunk/samba-pdbsql/debian/control 2006-03-27 11:12:08 UTC (rev 61) @@ -18,3 +18,11 @@ 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 +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 + from upstream Samba in version 3.0.22. Modified: trunk/samba-pdbsql/debian/rules =================================================================== --- trunk/samba-pdbsql/debian/rules 2006-03-26 14:00:44 UTC (rev 60) +++ trunk/samba-pdbsql/debian/rules 2006-03-27 11:12:08 UTC (rev 61) @@ -26,6 +26,7 @@ dh_install --sourcedir=`pwd`/debian/tmp dh_installdocs -p samba-pdb-pgsql AUTHORS docs/README dh_installdocs -p samba-pdb-mysql docs/pdb_mysql.html AUTHORS docs/README + dh_installdocs -p samba-pdb-multi 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 Added: trunk/samba-pdbsql/debian/samba-pdb-multi.install =================================================================== --- trunk/samba-pdbsql/debian/samba-pdb-multi.install (rev 0) +++ trunk/samba-pdbsql/debian/samba-pdb-multi.install 2006-03-27 11:12:08 UTC (rev 61) @@ -0,0 +1 @@ +usr/lib/samba/pdb/multi.so This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-26 14:00:49
|
Revision: 60 Author: synnack Date: 2006-03-26 06:00:44 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=60&view=rev Log Message: ----------- Multisam usable now: * Fix compiler warnings by commenting out unused functions. * Fix group mappings with *sqlsam and tdbsam. Theoretically groupmappings should also work with ldap as one of the backends, but have not tested that. * User operations work (adding/removing/listing). Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-26 11:03:21 UTC (rev 59) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-26 14:00:44 UTC (rev 60) @@ -76,6 +76,7 @@ return True; } +#if 0 static BOOL multisam_search_groups(struct pdb_methods *methods, struct pdb_search *search) { @@ -96,7 +97,6 @@ return False; } - static NTSTATUS multisam_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value) { DEBUG(1, ("This function is not implemented yet\n")); @@ -114,6 +114,7 @@ DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } +#endif /* 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, @@ -182,7 +183,7 @@ return False; } - +#if 0 static NTSTATUS multisam_set_unix_primary_group(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, struct samu *sampass) @@ -190,8 +191,8 @@ 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) @@ -217,10 +218,21 @@ TALLOC_CTX *mem_ctx, struct samu *sam_acct) { - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; + short i; + 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; + } + } + DEBUG(1, ("Could not find user in multisam backends\n")); + return NT_STATUS_UNSUCCESSFUL; } +#if 0 static NTSTATUS multisam_enum_group_memberships(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, struct samu *user, @@ -253,12 +265,6 @@ } -static NTSTATUS multisam_rename_sam_account (struct pdb_methods *methods, struct samu *pwd, const char *newname) -{ - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS multisam_update_login_attempts (struct pdb_methods *methods, struct samu *newpwd, BOOL success) { DEBUG(1, ("This function is not implemented yet\n")); @@ -285,6 +291,7 @@ 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) @@ -293,7 +300,8 @@ struct multisam_data *data; SET_DATA(data, methods); - + + DEBUG(1, ("Adding group map entry\n")); for (i = 0; i < data->num_backends; i++) { if (!IS_DEFAULT(data->methods[i], add_group_mapping_entry)) { return data->methods[i]->add_group_mapping_entry(data->methods[i], map); @@ -343,6 +351,7 @@ return NT_STATUS_UNSUCCESSFUL; } +#if 0 static NTSTATUS multisam_enum_group_mapping(struct pdb_methods *methods, const DOM_SID *sid, enum SID_NAME_USE sid_name_use, GROUP_MAP **pp_rmap, size_t *p_num_entries, @@ -422,6 +431,7 @@ DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } +#endif /* Creates user list in every backend */ static NTSTATUS multisam_setsampwent(struct pdb_methods *methods, BOOL update, uint32 acb_mask) @@ -583,7 +593,25 @@ } return NT_STATUS_UNSUCCESSFUL; } +static NTSTATUS multisam_rename_sam_account (struct pdb_methods *methods, struct samu *pwd, const char *newname) +{ + 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++) { + ret = data->methods[i]->rename_sam_account(data->methods[i], pwd, newname); + if (NT_STATUS_IS_OK(ret)) { + return ret; + } + } + return NT_STATUS_UNSUCCESSFUL; +} + +#if 0 static NTSTATUS multisam_lookup_rids(struct pdb_methods *methods, const DOM_SID *domain_sid, int num_rids, @@ -620,6 +648,7 @@ DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } +#endif /* The rid algorithm of the first backend is used. */ static BOOL multisam_rid_algorithm (struct pdb_methods *methods) @@ -680,9 +709,6 @@ (*pdb_method)->gid_to_sid = multisam_gid_to_sid; (*pdb_method)->sid_to_id = multisam_sid_to_id; - (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; - (*pdb_method)->update_group_mapping_entry = multisam_update_group_mapping_entry; - (*pdb_method)->delete_group_mapping_entry = multisam_delete_group_mapping_entry; /* Not yet implemented here */ #if 0 @@ -754,6 +780,13 @@ if (NT_STATUS_IS_ERR(nt_status)) { return nt_status; } + /* These functions are only used on LDAP now.. */ + if (!IS_DEFAULT(data->methods[i], add_group_mapping_entry)) + (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; + if (!IS_DEFAULT(data->methods[i], update_group_mapping_entry)) + (*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; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-26 11:03:38
|
Revision: 59 Author: synnack Date: 2006-03-26 03:03:21 -0800 (Sun, 26 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=59&view=rev Log Message: ----------- Made a start with the rid functions.. Does not work yet. Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-25 15:03:00 UTC (rev 58) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-26 11:03:21 UTC (rev 59) @@ -46,6 +46,36 @@ } #define IS_DEFAULT(methods, function) ((*(data->default_methods)->function) == (*(methods)->function)) +static BOOL multisam_new_rid(struct pdb_methods *methods, + uint32 *rid, + 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)) { + return False; + } + /* FIXME We need a function to check if a rid is used. + if () { + *rid = 0; + } */ + } + + if (*rid == 0) { + return False; + } + + return True; +} + static BOOL multisam_search_groups(struct pdb_methods *methods, struct pdb_search *search) { @@ -173,7 +203,14 @@ DEBUG(0, ("Creating user in first multisam backend\n")); /* XXX Might be nice to allow separations of machine accounts here? */ - return data->methods[0]->create_user(data->methods[0], tmp_ctx, name, acb_info, rid); + + + /* Get a new free rid if necessary */ + if (data->methods[0]->rid_algorithm(data->methods[0])) { + multisam_new_rid(methods, rid, 0); + } + + return data->methods[0]->create_user(data->methods[0], tmp_ctx, name, acb_info, rid); } static NTSTATUS multisam_delete_user(struct pdb_methods *methods, @@ -252,22 +289,58 @@ static NTSTATUS multisam_add_group_mapping_entry(struct pdb_methods *methods, GROUP_MAP *map) { - DEBUG(1, ("This function is not implemented yet\n")); + short i; + struct multisam_data *data; + + SET_DATA(data, methods); + + for (i = 0; i < data->num_backends; i++) { + if (!IS_DEFAULT(data->methods[i], add_group_mapping_entry)) { + 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) { - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; + short i; + struct multisam_data *data; + NTSTATUS ret; + + SET_DATA(data, methods); + + for (i = 0; i < data->num_backends; i++) { + if (!IS_DEFAULT(data->methods[i], update_group_mapping_entry)) { + ret = data->methods[i]->update_group_mapping_entry(data->methods[i], map); + if (NT_STATUS_IS_OK(ret)) { + return ret; + } + } + } + return NT_STATUS_UNSUCCESSFUL; } static NTSTATUS multisam_delete_group_mapping_entry(struct pdb_methods *methods, DOM_SID sid) { - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; + short i; + struct multisam_data *data; + NTSTATUS ret; + + SET_DATA(data, methods); + + for (i = 0; i < data->num_backends; i++) { + if (!IS_DEFAULT(data->methods[i], delete_group_mapping_entry)) { + ret = data->methods[i]->delete_group_mapping_entry(data->methods[i], sid); + if (NT_STATUS_IS_OK(ret)) { + return ret; + } + } + } + return NT_STATUS_UNSUCCESSFUL; } static NTSTATUS multisam_enum_group_mapping(struct pdb_methods *methods, @@ -518,7 +591,6 @@ const char **names, uint32 *attrs) { - DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -552,24 +624,13 @@ /* The rid algorithm of the first backend is used. */ static BOOL multisam_rid_algorithm (struct pdb_methods *methods) { - struct multisam_data *data; - - if (!methods) return False; - data = (struct multisam_data *)methods->private_data; - if (!data) return False; - - return data->methods[0]->rid_algorithm(data->methods[0]); + return True; } -/* New rid algorithm of the first backend is used (we add there anyway) */ -static BOOL multisam_new_rid (struct pdb_methods *methods, uint32 *rid) +/* This function is a fallback for errors */ +static BOOL multisam_dummy_new_rid (struct pdb_methods *methods, uint32 *rid) { - struct multisam_data *data; - - if (!methods) return False; - data = (struct multisam_data *)methods->private_data; - if (!data) return False; - - return data->methods[0]->new_rid(data->methods[0], rid); + DEBUG(0, ("This function should not be used!\n")); + return False; } static NTSTATUS multisam_init(struct pdb_methods **pdb_method, const char *location) @@ -611,13 +672,17 @@ (*pdb_method)->delete_sam_account = multisam_delete_sam_account; (*pdb_method)->rename_sam_account = multisam_rename_sam_account; (*pdb_method)->rid_algorithm = multisam_rid_algorithm; - (*pdb_method)->new_rid = multisam_new_rid; + (*pdb_method)->new_rid = multisam_dummy_new_rid; (*pdb_method)->create_user = multisam_create_user; (*pdb_method)->delete_user = multisam_delete_user; (*pdb_method)->uid_to_rid = multisam_uid_to_rid; (*pdb_method)->gid_to_sid = multisam_gid_to_sid; (*pdb_method)->sid_to_id = multisam_sid_to_id; + + (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; + (*pdb_method)->update_group_mapping_entry = multisam_update_group_mapping_entry; + (*pdb_method)->delete_group_mapping_entry = multisam_delete_group_mapping_entry; /* Not yet implemented here */ #if 0 @@ -627,9 +692,6 @@ (*pdb_method)->getgrnam = multisam_getgrnam; (*pdb_method)->create_dom_group = multisam_create_dom_group; (*pdb_method)->delete_dom_group = multisam_delete_dom_group; - (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; - (*pdb_method)->update_group_mapping_entry = multisam_update_group_mapping_entry; - (*pdb_method)->delete_group_mapping_entry = multisam_delete_group_mapping_entry; (*pdb_method)->enum_group_mapping = multisam_enum_group_mapping; (*pdb_method)->enum_group_members = multisam_enum_group_members; (*pdb_method)->enum_group_memberships = multisam_enum_group_memberships; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-25 15:03:07
|
Revision: 58 Author: synnack Date: 2006-03-25 07:03:00 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=58&view=rev Log Message: ----------- Fix rid algorithms. Adding users w/ pdbedit now also works. Modified Paths: -------------- trunk/samba-pdbsql/pdb_mysql.c trunk/samba-pdbsql/pdb_pgsql.c Modified: trunk/samba-pdbsql/pdb_mysql.c =================================================================== --- trunk/samba-pdbsql/pdb_mysql.c 2006-03-25 15:00:30 UTC (rev 57) +++ trunk/samba-pdbsql/pdb_mysql.c 2006-03-25 15:03:00 UTC (rev 58) @@ -504,11 +504,10 @@ } static BOOL mysqlsam_rid_algorithm (struct pdb_methods *pdb_methods) { - return False; + return True; } static BOOL mysqlsam_new_rid (struct pdb_methods *pdb_methods, uint32 *rid) { - *rid = 0; - return True; + return False; } static NTSTATUS mysqlsam_init(struct pdb_methods **pdb_method, const char *location) Modified: trunk/samba-pdbsql/pdb_pgsql.c =================================================================== --- trunk/samba-pdbsql/pdb_pgsql.c 2006-03-25 15:00:30 UTC (rev 57) +++ trunk/samba-pdbsql/pdb_pgsql.c 2006-03-25 15:03:00 UTC (rev 58) @@ -536,11 +536,10 @@ } static BOOL pgsqlsam_rid_algorithm (struct pdb_methods *pdb_methods) { - return False; + return True; } static BOOL pgsqlsam_new_rid (struct pdb_methods *pdb_methods, uint32 *rid) { - *rid = 0; - return True; + return False; } static NTSTATUS pgsqlsam_init (struct pdb_methods **pdb_method, const char *location ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ctr...@us...> - 2006-03-25 15:00:41
|
Revision: 57 Author: ctrlsoft Date: 2006-03-25 07:00:30 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=57&view=rev Log Message: ----------- Fix extension Modified Paths: -------------- trunk/samba-pdbsql/Makefile.in Modified: trunk/samba-pdbsql/Makefile.in =================================================================== --- trunk/samba-pdbsql/Makefile.in 2006-03-25 14:11:30 UTC (rev 56) +++ trunk/samba-pdbsql/Makefile.in 2006-03-25 15:00:30 UTC (rev 57) @@ -5,7 +5,7 @@ SHLIBEXT = @SHLIBEXT@ -modules = multi.$(SHLIBEXT) @modules@ +modules = multi @modules@ MYSQL_LIBS = @MYSQL_LIBS@ PGSQL_LIBS = @PGSQL_LIBS@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-25 14:11:42
|
Revision: 56 Author: synnack Date: 2006-03-25 06:11:30 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=56&view=rev Log Message: ----------- Removed too much.. here's the IS_DEFAULT macro back.. Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-25 14:08:57 UTC (rev 55) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-25 14:11:30 UTC (rev 56) @@ -44,6 +44,7 @@ return NT_STATUS_INVALID_HANDLE; \ } \ } +#define IS_DEFAULT(methods, function) ((*(data->default_methods)->function) == (*(methods)->function)) static BOOL multisam_search_groups(struct pdb_methods *methods, struct pdb_search *search) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-25 14:09:13
|
Revision: 55 Author: synnack Date: 2006-03-25 06:08:57 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=55&view=rev Log Message: ----------- Fix late night fuzzy brain waves. (not implementing stuff that's not implemented in multisam) Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-25 13:39:24 UTC (rev 54) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-25 14:08:57 UTC (rev 55) @@ -44,7 +44,6 @@ return NT_STATUS_INVALID_HANDLE; \ } \ } -#define IS_DEFAULT(methods, function) ((*(data->default_methods)->function) == (*(methods)->function)) static BOOL multisam_search_groups(struct pdb_methods *methods, struct pdb_search *search) @@ -613,7 +612,46 @@ (*pdb_method)->rid_algorithm = multisam_rid_algorithm; (*pdb_method)->new_rid = multisam_new_rid; + (*pdb_method)->create_user = multisam_create_user; + (*pdb_method)->delete_user = multisam_delete_user; + (*pdb_method)->uid_to_rid = multisam_uid_to_rid; + (*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; + (*pdb_method)->getgrsid = multisam_getgrsid; + (*pdb_method)->getgrgid = multisam_getgrgid; + (*pdb_method)->getgrnam = multisam_getgrnam; + (*pdb_method)->create_dom_group = multisam_create_dom_group; + (*pdb_method)->delete_dom_group = multisam_delete_dom_group; + (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; + (*pdb_method)->update_group_mapping_entry = multisam_update_group_mapping_entry; + (*pdb_method)->delete_group_mapping_entry = multisam_delete_group_mapping_entry; + (*pdb_method)->enum_group_mapping = multisam_enum_group_mapping; + (*pdb_method)->enum_group_members = multisam_enum_group_members; + (*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; + (*pdb_method)->set_aliasinfo = multisam_set_aliasinfo; + (*pdb_method)->add_aliasmem = multisam_add_aliasmem; + (*pdb_method)->del_aliasmem = multisam_del_aliasmem; + (*pdb_method)->enum_aliasmem = multisam_enum_aliasmem; + (*pdb_method)->enum_alias_memberships = multisam_alias_memberships; + (*pdb_method)->lookup_rids = multisam_lookup_rids; + (*pdb_method)->get_account_policy = multisam_get_account_policy; + (*pdb_method)->set_account_policy = multisam_set_account_policy; + (*pdb_method)->get_seq_num = multisam_get_seq_num; + (*pdb_method)->search_users = multisam_search_users; + (*pdb_method)->search_groups = multisam_search_groups; + (*pdb_method)->search_aliases = multisam_search_aliases; +#endif + if (!location) { DEBUG(0, ("No identifier specified. Check the Samba HOWTO Collection for details\n")); return NT_STATUS_INVALID_PARAMETER; @@ -653,81 +691,7 @@ if (NT_STATUS_IS_ERR(nt_status)) { return nt_status; } - - /* Optional.. only set if implemented */ - if (!IS_DEFAULT(data->methods[i], update_login_attempts)) - (*pdb_method)->update_login_attempts = multisam_update_login_attempts; - if (!IS_DEFAULT(data->methods[i], create_user)) - (*pdb_method)->create_user = multisam_create_user; - if (!IS_DEFAULT(data->methods[i], delete_user)) - (*pdb_method)->delete_user = multisam_delete_user; - if (!IS_DEFAULT(data->methods[i], getgrsid)) - (*pdb_method)->getgrsid = multisam_getgrsid; - if (!IS_DEFAULT(data->methods[i], getgrgid)) - (*pdb_method)->getgrgid = multisam_getgrgid; - if (!IS_DEFAULT(data->methods[i], getgrnam)) - (*pdb_method)->getgrnam = multisam_getgrnam; - if (!IS_DEFAULT(data->methods[i], create_dom_group)) - (*pdb_method)->create_dom_group = multisam_create_dom_group; - if (!IS_DEFAULT(data->methods[i], delete_dom_group)) - (*pdb_method)->delete_dom_group = multisam_delete_dom_group; - if (!IS_DEFAULT(data->methods[i], add_group_mapping_entry)) - (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; - if (!IS_DEFAULT(data->methods[i], update_group_mapping_entry)) - (*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; - if (!IS_DEFAULT(data->methods[i], enum_group_mapping)) - (*pdb_method)->enum_group_mapping = multisam_enum_group_mapping; - if (!IS_DEFAULT(data->methods[i], enum_group_members)) - (*pdb_method)->enum_group_members = multisam_enum_group_members; - if (!IS_DEFAULT(data->methods[i], enum_group_memberships)) - (*pdb_method)->enum_group_memberships = multisam_enum_group_memberships; - if (!IS_DEFAULT(data->methods[i], set_unix_primary_group)) - (*pdb_method)->set_unix_primary_group = multisam_set_unix_primary_group; - if (!IS_DEFAULT(data->methods[i], add_groupmem)) - (*pdb_method)->add_groupmem = multisam_add_groupmem; - if (!IS_DEFAULT(data->methods[i], del_groupmem)) - (*pdb_method)->del_groupmem = multisam_del_groupmem; - if (!IS_DEFAULT(data->methods[i], find_alias)) - (*pdb_method)->find_alias = multisam_find_alias; - if (!IS_DEFAULT(data->methods[i], create_alias)) - (*pdb_method)->create_alias = multisam_create_alias; - if (!IS_DEFAULT(data->methods[i], delete_alias)) - (*pdb_method)->delete_alias = multisam_delete_alias; - if (!IS_DEFAULT(data->methods[i], get_aliasinfo)) - (*pdb_method)->get_aliasinfo = multisam_get_aliasinfo; - if (!IS_DEFAULT(data->methods[i], set_aliasinfo)) - (*pdb_method)->set_aliasinfo = multisam_set_aliasinfo; - if (!IS_DEFAULT(data->methods[i], add_aliasmem)) - (*pdb_method)->add_aliasmem = multisam_add_aliasmem; - if (!IS_DEFAULT(data->methods[i], del_aliasmem)) - (*pdb_method)->del_aliasmem = multisam_del_aliasmem; - if (!IS_DEFAULT(data->methods[i], enum_aliasmem)) - (*pdb_method)->enum_aliasmem = multisam_enum_aliasmem; - if (!IS_DEFAULT(data->methods[i], enum_alias_memberships)) - (*pdb_method)->enum_alias_memberships = multisam_alias_memberships; - if (!IS_DEFAULT(data->methods[i], lookup_rids)) - (*pdb_method)->lookup_rids = multisam_lookup_rids; - if (!IS_DEFAULT(data->methods[i], get_account_policy)) - (*pdb_method)->get_account_policy = multisam_get_account_policy; - if (!IS_DEFAULT(data->methods[i], set_account_policy)) - (*pdb_method)->set_account_policy = multisam_set_account_policy; - if (!IS_DEFAULT(data->methods[i], get_seq_num)) - (*pdb_method)->get_seq_num = multisam_get_seq_num; - if (!IS_DEFAULT(data->methods[i], uid_to_rid)) - (*pdb_method)->uid_to_rid = multisam_uid_to_rid; - if (!IS_DEFAULT(data->methods[i], gid_to_sid)) - (*pdb_method)->gid_to_sid = multisam_gid_to_sid; - if (!IS_DEFAULT(data->methods[i], sid_to_id)) - (*pdb_method)->sid_to_id = multisam_sid_to_id; - if (!IS_DEFAULT(data->methods[i], search_users)) - (*pdb_method)->search_users = multisam_search_users; - if (!IS_DEFAULT(data->methods[i], search_groups)) - (*pdb_method)->search_groups = multisam_search_groups; - if (!IS_DEFAULT(data->methods[i], search_aliases)) - (*pdb_method)->search_aliases = multisam_search_aliases; - } + } return NT_STATUS_OK; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ctr...@us...> - 2006-03-25 13:39:29
|
Revision: 54 Author: ctrlsoft Date: 2006-03-25 05:39:24 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=54&view=rev Log Message: ----------- Add multi.so by default. Modified Paths: -------------- trunk/samba-pdbsql/Makefile.in Modified: trunk/samba-pdbsql/Makefile.in =================================================================== --- trunk/samba-pdbsql/Makefile.in 2006-03-25 13:35:03 UTC (rev 53) +++ trunk/samba-pdbsql/Makefile.in 2006-03-25 13:39:24 UTC (rev 54) @@ -3,10 +3,10 @@ CC = @CC@ INSTALL = @INSTALL@ -modules = @modules@ - SHLIBEXT = @SHLIBEXT@ +modules = multi.$(SHLIBEXT) @modules@ + MYSQL_LIBS = @MYSQL_LIBS@ PGSQL_LIBS = @PGSQL_LIBS@ SOURCEDIR = @SOURCEDIR@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-25 13:35:18
|
Revision: 53 Author: synnack Date: 2006-03-25 05:35:03 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=53&view=rev Log Message: ----------- Fix typo Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-25 13:26:54 UTC (rev 52) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-25 13:35:03 UTC (rev 53) @@ -705,7 +705,7 @@ (*pdb_method)->del_aliasmem = multisam_del_aliasmem; if (!IS_DEFAULT(data->methods[i], enum_aliasmem)) (*pdb_method)->enum_aliasmem = multisam_enum_aliasmem; - if (!IS_DEFAULT(data->methods[i], alias_memberships)) + if (!IS_DEFAULT(data->methods[i], enum_alias_memberships)) (*pdb_method)->enum_alias_memberships = multisam_alias_memberships; if (!IS_DEFAULT(data->methods[i], lookup_rids)) (*pdb_method)->lookup_rids = multisam_lookup_rids; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-25 13:27:16
|
Revision: 52 Author: synnack Date: 2006-03-25 05:26:54 -0800 (Sat, 25 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=52&view=rev Log Message: ----------- Added IS_DEFAULT macro and creating new default pdb_method for comparison. This is useful for testing if a backend relies on pdb_default_* functions, so we can check what features a backend has implemented. Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-25 01:23:42 UTC (rev 51) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-25 13:26:54 UTC (rev 52) @@ -31,6 +31,7 @@ char **names; char **locations; struct pdb_methods **methods; + struct pdb_methods *default_methods; } multisam_data; #define SET_DATA(data,methods) { \ @@ -43,6 +44,7 @@ return NT_STATUS_INVALID_HANDLE; \ } \ } +#define IS_DEFAULT(methods, function) ((*(data->default_methods)->function) == (*(methods)->function)) static BOOL multisam_search_groups(struct pdb_methods *methods, struct pdb_search *search) @@ -169,6 +171,8 @@ SET_DATA(data, methods); DEBUG(0, ("Creating user in first multisam backend\n")); + + /* XXX Might be nice to allow separations of machine accounts here? */ return data->methods[0]->create_user(data->methods[0], tmp_ctx, name, acb_info, rid); } @@ -584,6 +588,15 @@ if ( !NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method )) ) { return nt_status; } + + data = talloc(*pdb_method, struct multisam_data); + (*pdb_method)->private_data = data; + + /* Create default_methods with default functions (as in pdb_interface.c) */ + if (!NT_STATUS_IS_OK(nt_status = make_pdb_method( &(data->default_methods)))) { + DEBUG(0, ("Could not create default pdb_method\n")); + return nt_status; + } (*pdb_method)->name = "multisam"; @@ -601,9 +614,6 @@ (*pdb_method)->new_rid = multisam_new_rid; - data = talloc(*pdb_method, struct multisam_data); - (*pdb_method)->private_data = data; - if (!location) { DEBUG(0, ("No identifier specified. Check the Samba HOWTO Collection for details\n")); return NT_STATUS_INVALID_PARAMETER; @@ -645,77 +655,77 @@ } /* Optional.. only set if implemented */ - if (*(data->methods[i])->update_login_attempts != (*pdb_method)->update_login_attempts) + if (!IS_DEFAULT(data->methods[i], update_login_attempts)) (*pdb_method)->update_login_attempts = multisam_update_login_attempts; - if (*(data->methods[i])->create_user != (*pdb_method)->create_user) + if (!IS_DEFAULT(data->methods[i], create_user)) (*pdb_method)->create_user = multisam_create_user; - if (*(data->methods[i])->delete_user != (*pdb_method)->delete_user) + if (!IS_DEFAULT(data->methods[i], delete_user)) (*pdb_method)->delete_user = multisam_delete_user; - if (*(data->methods[i])->getgrsid != (*pdb_method)->getgrsid) + if (!IS_DEFAULT(data->methods[i], getgrsid)) (*pdb_method)->getgrsid = multisam_getgrsid; - if (*(data->methods[i])->getgrgid != (*pdb_method)->getgrgid) + if (!IS_DEFAULT(data->methods[i], getgrgid)) (*pdb_method)->getgrgid = multisam_getgrgid; - if (*(data->methods[i])->getgrnam != (*pdb_method)->getgrnam) + if (!IS_DEFAULT(data->methods[i], getgrnam)) (*pdb_method)->getgrnam = multisam_getgrnam; - if (*(data->methods[i])->create_dom_group != (*pdb_method)->create_dom_group) + if (!IS_DEFAULT(data->methods[i], create_dom_group)) (*pdb_method)->create_dom_group = multisam_create_dom_group; - if (*(data->methods[i])->delete_dom_group != (*pdb_method)->delete_dom_group) + if (!IS_DEFAULT(data->methods[i], delete_dom_group)) (*pdb_method)->delete_dom_group = multisam_delete_dom_group; - if (*(data->methods[i])->add_group_mapping_entry != (*pdb_method)->add_group_mapping_entry) + if (!IS_DEFAULT(data->methods[i], add_group_mapping_entry)) (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; - if (*(data->methods[i])->update_group_mapping_entry != (*pdb_method)->update_group_mapping_entry) + if (!IS_DEFAULT(data->methods[i], update_group_mapping_entry)) (*pdb_method)->update_group_mapping_entry = multisam_update_group_mapping_entry; - if (*(data->methods[i])->delete_group_mapping_entry != (*pdb_method)->delete_group_mapping_entry) + if (!IS_DEFAULT(data->methods[i], delete_group_mapping_entry)) (*pdb_method)->delete_group_mapping_entry = multisam_delete_group_mapping_entry; - if (*(data->methods[i])->enum_group_mapping != (*pdb_method)->enum_group_mapping) + if (!IS_DEFAULT(data->methods[i], enum_group_mapping)) (*pdb_method)->enum_group_mapping = multisam_enum_group_mapping; - if (*(data->methods[i])->enum_group_members != (*pdb_method)->enum_group_members) + if (!IS_DEFAULT(data->methods[i], enum_group_members)) (*pdb_method)->enum_group_members = multisam_enum_group_members; - if (*(data->methods[i])->enum_group_memberships != (*pdb_method)->enum_group_memberships) + if (!IS_DEFAULT(data->methods[i], enum_group_memberships)) (*pdb_method)->enum_group_memberships = multisam_enum_group_memberships; - if (*(data->methods[i])->set_unix_primary_group != (*pdb_method)->set_unix_primary_group) + if (!IS_DEFAULT(data->methods[i], set_unix_primary_group)) (*pdb_method)->set_unix_primary_group = multisam_set_unix_primary_group; - if (*(data->methods[i])->add_groupmem != (*pdb_method)->add_groupmem) + if (!IS_DEFAULT(data->methods[i], add_groupmem)) (*pdb_method)->add_groupmem = multisam_add_groupmem; - if (*(data->methods[i])->del_groupmem != (*pdb_method)->del_groupmem) + if (!IS_DEFAULT(data->methods[i], del_groupmem)) (*pdb_method)->del_groupmem = multisam_del_groupmem; - if (*(data->methods[i])->find_alias != (*pdb_method)->find_alias) + if (!IS_DEFAULT(data->methods[i], find_alias)) (*pdb_method)->find_alias = multisam_find_alias; - if (*(data->methods[i])->create_alias != (*pdb_method)->create_alias) + if (!IS_DEFAULT(data->methods[i], create_alias)) (*pdb_method)->create_alias = multisam_create_alias; - if (*(data->methods[i])->delete_alias != (*pdb_method)->delete_alias) + if (!IS_DEFAULT(data->methods[i], delete_alias)) (*pdb_method)->delete_alias = multisam_delete_alias; - if (*(data->methods[i])->get_aliasinfo != (*pdb_method)->get_aliasinfo) + if (!IS_DEFAULT(data->methods[i], get_aliasinfo)) (*pdb_method)->get_aliasinfo = multisam_get_aliasinfo; - if (*(data->methods[i])->set_aliasinfo != (*pdb_method)->set_aliasinfo) + if (!IS_DEFAULT(data->methods[i], set_aliasinfo)) (*pdb_method)->set_aliasinfo = multisam_set_aliasinfo; - if (*(data->methods[i])->add_aliasmem != (*pdb_method)->add_aliasmem) + if (!IS_DEFAULT(data->methods[i], add_aliasmem)) (*pdb_method)->add_aliasmem = multisam_add_aliasmem; - if (*(data->methods[i])->del_aliasmem != (*pdb_method)->del_aliasmem) + if (!IS_DEFAULT(data->methods[i], del_aliasmem)) (*pdb_method)->del_aliasmem = multisam_del_aliasmem; - if (*(data->methods[i])->enum_aliasmem != (*pdb_method)->enum_aliasmem) + if (!IS_DEFAULT(data->methods[i], enum_aliasmem)) (*pdb_method)->enum_aliasmem = multisam_enum_aliasmem; - if (*(data->methods[i])->enum_alias_memberships != (*pdb_method)->enum_alias_memberships) + if (!IS_DEFAULT(data->methods[i], alias_memberships)) (*pdb_method)->enum_alias_memberships = multisam_alias_memberships; - if (*(data->methods[i])->lookup_rids != (*pdb_method)->lookup_rids) + if (!IS_DEFAULT(data->methods[i], lookup_rids)) (*pdb_method)->lookup_rids = multisam_lookup_rids; - if (*(data->methods[i])->get_account_policy != (*pdb_method)->get_account_policy) + if (!IS_DEFAULT(data->methods[i], get_account_policy)) (*pdb_method)->get_account_policy = multisam_get_account_policy; - if (*(data->methods[i])->set_account_policy != (*pdb_method)->set_account_policy) + if (!IS_DEFAULT(data->methods[i], set_account_policy)) (*pdb_method)->set_account_policy = multisam_set_account_policy; - if (*(data->methods[i])->get_seq_num != (*pdb_method)->get_seq_num) + if (!IS_DEFAULT(data->methods[i], get_seq_num)) (*pdb_method)->get_seq_num = multisam_get_seq_num; - if (*(data->methods[i])->uid_to_rid != (*pdb_method)->uid_to_rid) + if (!IS_DEFAULT(data->methods[i], uid_to_rid)) (*pdb_method)->uid_to_rid = multisam_uid_to_rid; - if (*(data->methods[i])->gid_to_sid != (*pdb_method)->gid_to_sid) + if (!IS_DEFAULT(data->methods[i], gid_to_sid)) (*pdb_method)->gid_to_sid = multisam_gid_to_sid; - if (*(data->methods[i])->sid_to_id != (*pdb_method)->sid_to_id) + if (!IS_DEFAULT(data->methods[i], sid_to_id)) (*pdb_method)->sid_to_id = multisam_sid_to_id; - if (*(data->methods[i])->search_users != (*pdb_method)->search_users) + if (!IS_DEFAULT(data->methods[i], search_users)) (*pdb_method)->search_users = multisam_search_users; - if (*(data->methods[i])->search_groups != (*pdb_method)->search_groups) + if (!IS_DEFAULT(data->methods[i], search_groups)) (*pdb_method)->search_groups = multisam_search_groups; - if (*(data->methods[i])->search_aliases != (*pdb_method)->search_aliases) + if (!IS_DEFAULT(data->methods[i], search_aliases)) (*pdb_method)->search_aliases = multisam_search_aliases; } return NT_STATUS_OK; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-25 01:23:47
|
Revision: 51 Author: synnack Date: 2006-03-24 17:23:42 -0800 (Fri, 24 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=51&view=rev Log Message: ----------- Implemented some extra functions (untested) Added some comments Checking in so you guys have the latest dev version in the morning. Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-25 00:39:53 UTC (rev 50) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-25 01:23:42 UTC (rev 51) @@ -83,22 +83,70 @@ return NT_STATUS_NOT_IMPLEMENTED; } +/* 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; } +/* 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) { + 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 DOM_SID *sid, union unid_t *id, enum SID_NAME_USE *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; } @@ -116,8 +164,12 @@ TALLOC_CTX *tmp_ctx, const char *name, uint32 acb_info, uint32 *rid) { - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; + struct multisam_data *data; + + SET_DATA(data, methods); + + DEBUG(0, ("Creating user in first multisam backend\n")); + return data->methods[0]->create_user(data->methods[0], tmp_ctx, name, acb_info, rid); } static NTSTATUS multisam_delete_user(struct pdb_methods *methods, @@ -294,7 +346,7 @@ return NT_STATUS_NOT_IMPLEMENTED; } - +/* Creates user list in every backend */ static NTSTATUS multisam_setsampwent(struct pdb_methods *methods, BOOL update, uint32 acb_mask) { short i; @@ -318,7 +370,7 @@ /*************************************************************** End enumeration of the passwd list. ****************************************************************/ - +/* Runs endsampwent on every backend */ static void multisam_endsampwent(struct pdb_methods *methods) { short i; @@ -338,7 +390,7 @@ /***************************************************************** Get one struct samu from the list (next in line) *****************************************************************/ - +/* Reads every user from backend 0, then 1.. etc (returns one) */ static NTSTATUS multisam_getsampwent(struct pdb_methods *methods, struct samu * user) { short i; @@ -360,7 +412,7 @@ /****************************************************************** Lookup a name in the SAM database ******************************************************************/ - +/* 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) { @@ -384,7 +436,7 @@ /*************************************************************************** Search by sid **************************************************************************/ - +/* 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) { @@ -407,7 +459,7 @@ /*************************************************************************** Delete a sam account ****************************************************************************/ - +/* 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) { @@ -425,16 +477,18 @@ return NT_STATUS_UNSUCCESSFUL; } +/* Creates sam account in the first backend */ static NTSTATUS multisam_add_sam_account(struct pdb_methods *methods, struct samu * newpwd) { struct multisam_data *data; SET_DATA(data, methods); - DEBUG(0, ("Creating user in first multisam backend\n")); + DEBUG(0, ("Creating sam account in first multisam backend\n")); return data->methods[0]->add_sam_account(data->methods[0], newpwd); } +/* Tries update in every backend, if one succeeds we're happy. */ static NTSTATUS multisam_update_sam_account(struct pdb_methods *methods, struct samu * newpwd) { @@ -491,14 +545,27 @@ return NT_STATUS_NOT_IMPLEMENTED; } +/* The rid algorithm of the first backend is used. */ static BOOL multisam_rid_algorithm (struct pdb_methods *methods) { - return False; + struct multisam_data *data; + + if (!methods) return False; + data = (struct multisam_data *)methods->private_data; + if (!data) return False; + + return data->methods[0]->rid_algorithm(data->methods[0]); } +/* New rid algorithm of the first backend is used (we add there anyway) */ static BOOL multisam_new_rid (struct pdb_methods *methods, uint32 *rid) { - *rid = 0; - return True; + struct multisam_data *data; + + if (!methods) return False; + data = (struct multisam_data *)methods->private_data; + if (!data) return False; + + return data->methods[0]->new_rid(data->methods[0], rid); } static NTSTATUS multisam_init(struct pdb_methods **pdb_method, const char *location) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-25 00:39:58
|
Revision: 50 Author: synnack Date: 2006-03-24 16:39:53 -0800 (Fri, 24 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=50&view=rev Log Message: ----------- Fix updating sam account only on the first backend. Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-24 23:58:06 UTC (rev 49) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-25 00:39:53 UTC (rev 50) @@ -438,12 +438,19 @@ static NTSTATUS multisam_update_sam_account(struct pdb_methods *methods, struct samu * newpwd) { + short i; struct multisam_data *data; + NTSTATUS ret; SET_DATA(data, methods); - DEBUG(0, ("Updating sam account in first multisam backend\n")); - /* FIXME: This only updates in the first one. */ - return data->methods[0]->update_sam_account(data->methods[0], newpwd); + DEBUG(5, ("Updating sam account.\n")); + for (i = 0; i < data->num_backends; i++) { + ret = data->methods[i]->update_sam_account(data->methods[i], newpwd); + if (NT_STATUS_IS_OK(ret)) { + return ret; + } + } + return NT_STATUS_UNSUCCESSFUL; } static NTSTATUS multisam_lookup_rids(struct pdb_methods *methods, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-24 23:58:12
|
Revision: 49 Author: synnack Date: 2006-03-24 15:58:06 -0800 (Fri, 24 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=49&view=rev Log Message: ----------- Changes for pdb_multi.c: * Fix setsampwent/getsampwent/endsampwent. * Fix delete_sam_account. * Fix update_sam_account. Can't get add_sam_account to work yet and pdbedit -a requires the new_rid functionality (pdb_*sql.c also, I suppose.. not 0 new_rid).. Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-24 22:05:42 UTC (rev 48) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-24 23:58:06 UTC (rev 49) @@ -297,8 +297,22 @@ static NTSTATUS multisam_setsampwent(struct pdb_methods *methods, BOOL update, uint32 acb_mask) { - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; + short i; + struct multisam_data *data; + NTSTATUS ret; + + SET_DATA(data, methods); + + DEBUG(1, ("Setsampwent executing..\n")); + + for (i = 0; i < data->num_backends; i++) { + ret = data->methods[i]->setsampwent(data->methods[i], update, acb_mask); + if (!NT_STATUS_IS_OK(ret)) { + return ret; + } + } + + return NT_STATUS_OK; } /*************************************************************** @@ -307,7 +321,18 @@ static void multisam_endsampwent(struct pdb_methods *methods) { + short i; + struct multisam_data *data; + if (!methods) return; + data = (struct multisam_data *)methods->private_data; + 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]); + } } /***************************************************************** @@ -316,8 +341,20 @@ static NTSTATUS multisam_getsampwent(struct pdb_methods *methods, struct samu * user) { - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; + 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; } /****************************************************************** @@ -374,28 +411,39 @@ static NTSTATUS multisam_delete_sam_account(struct pdb_methods *methods, struct samu * sam_pass) { - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; -} + short i; + struct multisam_data *data; -static NTSTATUS multisam_replace_sam_account(struct pdb_methods *methods, - struct samu * newpwd, char isupdate) -{ - DEBUG(1, ("This function is not implemented yet\n")); - return NT_STATUS_NOT_IMPLEMENTED; + 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; + } + } + DEBUG(1, ("Could not find SAM account in multisam backends\n")); + return NT_STATUS_UNSUCCESSFUL; } static NTSTATUS multisam_add_sam_account(struct pdb_methods *methods, struct samu * newpwd) { - DEBUG(1, ("This function is not implemented yet\n")); - return multisam_replace_sam_account(methods, newpwd, 0); + struct multisam_data *data; + + SET_DATA(data, methods); + + DEBUG(0, ("Creating user in first multisam backend\n")); + return data->methods[0]->add_sam_account(data->methods[0], newpwd); } static NTSTATUS multisam_update_sam_account(struct pdb_methods *methods, struct samu * newpwd) { - DEBUG(1, ("This function is not implemented yet\n")); - return multisam_replace_sam_account(methods, newpwd, 1); + struct multisam_data *data; + + SET_DATA(data, methods); + DEBUG(0, ("Updating sam account in first multisam backend\n")); + /* FIXME: This only updates in the first one. */ + return data->methods[0]->update_sam_account(data->methods[0], newpwd); } static NTSTATUS multisam_lookup_rids(struct pdb_methods *methods, @@ -491,6 +539,7 @@ data->names = str_list_make_talloc(data, data->location, NULL); data->num_backends = str_list_count((const char **)data->names); data->locations = talloc_array(data, char *, data->num_backends); + data->methods = talloc_array(data, struct pdb_methods *, data->num_backends); for (i = 0; i < data->num_backends; i++) { struct pdb_init_function_entry *entry = NULL; @@ -499,7 +548,6 @@ if (data->locations[i]) { *(data->locations[i]) = '\0'; data->locations[i]++; - DEBUG(5,("Got location: %s\n", data->locations[i])); } entry = pdb_find_backend_entry(data->names[i]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-24 22:06:00
|
Revision: 48 Author: synnack Date: 2006-03-24 14:05:42 -0800 (Fri, 24 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=48&view=rev Log Message: ----------- Actually made pdb_multi work.. still proof of concept, but at least authentication works. Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-24 18:44:44 UTC (rev 47) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-24 22:05:42 UTC (rev 48) @@ -1,6 +1,7 @@ /* * Support for multiple password databases * Copyright (C) Jelmer Vernooij 2006 + * Copyright (C) Wilco Baan Hofman 2006 * * 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 @@ -32,6 +33,17 @@ struct pdb_methods **methods; } multisam_data; +#define SET_DATA(data,methods) { \ + if(!methods){ \ + DEBUG(0, ("invalid methods!\n")); \ + return NT_STATUS_INVALID_PARAMETER; \ + } \ + data = (struct multisam_data *)methods->private_data; \ + if(!data){ \ + return NT_STATUS_INVALID_HANDLE; \ + } \ +} + static BOOL multisam_search_groups(struct pdb_methods *methods, struct pdb_search *search) { @@ -55,16 +67,19 @@ static NTSTATUS multisam_get_account_policy(struct pdb_methods *methods, int policy_index, 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) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_get_seq_num(struct pdb_methods *methods, time_t *seq_num) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -92,6 +107,7 @@ TALLOC_CTX *mem_ctx, struct samu *sampass) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -100,6 +116,7 @@ TALLOC_CTX *tmp_ctx, const char *name, uint32 acb_info, uint32 *rid) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -107,6 +124,7 @@ TALLOC_CTX *mem_ctx, struct samu *sam_acct) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -117,6 +135,7 @@ gid_t **pp_gids, size_t *p_num_groups) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -127,6 +146,7 @@ uint32 **pp_member_rids, size_t *p_num_members) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -135,53 +155,62 @@ TALLOC_CTX *mem_ctx, uint32 rid) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_rename_sam_account (struct pdb_methods *methods, struct samu *pwd, const char *newname) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_update_login_attempts (struct pdb_methods *methods, struct samu *newpwd, BOOL success) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map, 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) { + 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) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_add_group_mapping_entry(struct pdb_methods *methods, GROUP_MAP *map) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_update_group_mapping_entry(struct pdb_methods *methods, GROUP_MAP *map) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_delete_group_mapping_entry(struct pdb_methods *methods, DOM_SID sid) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -190,24 +219,28 @@ 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; } static NTSTATUS multisam_find_alias(struct pdb_methods *methods, const char *name, DOM_SID *sid) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_create_alias(struct pdb_methods *methods, 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 DOM_SID *sid) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -215,6 +248,7 @@ const DOM_SID *sid, struct acct_info *info) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -222,18 +256,21 @@ const 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 DOM_SID *alias, const 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) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -241,6 +278,7 @@ const DOM_SID *alias, DOM_SID **pp_members, size_t *p_num_members) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -252,12 +290,14 @@ uint32 **pp_alias_rids, size_t *p_num_alias_rids) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_setsampwent(struct pdb_methods *methods, BOOL update, uint32 acb_mask) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -276,6 +316,7 @@ static NTSTATUS multisam_getsampwent(struct pdb_methods *methods, struct samu * user) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -286,7 +327,20 @@ static NTSTATUS multisam_getsampwnam(struct pdb_methods *methods, struct samu * user, const char *sname) { - return NT_STATUS_NOT_IMPLEMENTED; + 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))) { + DEBUG(3, ("Found user in %s\n", data->names[i])); + return ret; + } + } + return NT_STATUS_UNSUCCESSFUL; } @@ -297,7 +351,20 @@ static NTSTATUS multisam_getsampwsid(struct pdb_methods *methods, struct samu * user, const DOM_SID * sid) { - return NT_STATUS_NOT_IMPLEMENTED; + 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))) { + DEBUG(3, ("Found user in %s\n", data->names[i])); + return ret; + } + } + return NT_STATUS_UNSUCCESSFUL; } /*************************************************************************** @@ -307,23 +374,27 @@ static NTSTATUS multisam_delete_sam_account(struct pdb_methods *methods, struct samu * sam_pass) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_replace_sam_account(struct pdb_methods *methods, struct samu * newpwd, char isupdate) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } static NTSTATUS multisam_add_sam_account(struct pdb_methods *methods, struct samu * newpwd) { + DEBUG(1, ("This function is not implemented yet\n")); return multisam_replace_sam_account(methods, newpwd, 0); } static NTSTATUS multisam_update_sam_account(struct pdb_methods *methods, struct samu * newpwd) { + DEBUG(1, ("This function is not implemented yet\n")); return multisam_replace_sam_account(methods, newpwd, 1); } @@ -334,6 +405,7 @@ const char **names, uint32 *attrs) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -342,6 +414,7 @@ const char *name, uint32 *rid) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -350,6 +423,7 @@ uint32 group_rid, uint32 member_rid) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } @@ -358,9 +432,19 @@ uint32 group_rid, uint32 member_rid) { + DEBUG(1, ("This function is not implemented yet\n")); return NT_STATUS_NOT_IMPLEMENTED; } +static BOOL multisam_rid_algorithm (struct pdb_methods *methods) +{ + return False; +} +static BOOL multisam_new_rid (struct pdb_methods *methods, uint32 *rid) +{ + *rid = 0; + return True; +} static NTSTATUS multisam_init(struct pdb_methods **pdb_method, const char *location) { @@ -375,60 +459,26 @@ ("multisam: 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 = "multisam"; + /* Mandatory implementation */ (*pdb_method)->setsampwent = multisam_setsampwent; (*pdb_method)->endsampwent = multisam_endsampwent; (*pdb_method)->getsampwent = multisam_getsampwent; (*pdb_method)->getsampwnam = multisam_getsampwnam; (*pdb_method)->getsampwsid = multisam_getsampwsid; - (*pdb_method)->create_user = multisam_create_user; - (*pdb_method)->delete_user = multisam_delete_user; (*pdb_method)->add_sam_account = multisam_add_sam_account; (*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; - (*pdb_method)->update_login_attempts = multisam_update_login_attempts; + (*pdb_method)->rid_algorithm = multisam_rid_algorithm; + (*pdb_method)->new_rid = multisam_new_rid; - (*pdb_method)->getgrsid = multisam_getgrsid; - (*pdb_method)->getgrgid = multisam_getgrgid; - (*pdb_method)->getgrnam = multisam_getgrnam; - (*pdb_method)->create_dom_group = multisam_create_dom_group; - (*pdb_method)->delete_dom_group = multisam_delete_dom_group; - (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; - (*pdb_method)->update_group_mapping_entry = multisam_update_group_mapping_entry; - (*pdb_method)->delete_group_mapping_entry = multisam_delete_group_mapping_entry; - (*pdb_method)->enum_group_mapping = multisam_enum_group_mapping; - (*pdb_method)->enum_group_members = multisam_enum_group_members; - (*pdb_method)->enum_group_memberships = multisam_enum_group_memberships; - (*pdb_method)->set_unix_primary_group = multisam_set_unix_primary_group; - (*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; - (*pdb_method)->set_aliasinfo = multisam_set_aliasinfo; - (*pdb_method)->add_aliasmem = multisam_add_aliasmem; - (*pdb_method)->del_aliasmem = multisam_del_aliasmem; - (*pdb_method)->enum_aliasmem = multisam_enum_aliasmem; - (*pdb_method)->enum_alias_memberships = multisam_alias_memberships; - (*pdb_method)->lookup_rids = multisam_lookup_rids; - (*pdb_method)->get_account_policy = multisam_get_account_policy; - (*pdb_method)->set_account_policy = multisam_set_account_policy; - (*pdb_method)->get_seq_num = multisam_get_seq_num; - (*pdb_method)->uid_to_rid = multisam_uid_to_rid; - (*pdb_method)->gid_to_sid = multisam_gid_to_sid; - (*pdb_method)->sid_to_id = multisam_sid_to_id; - (*pdb_method)->search_users = multisam_search_users; - (*pdb_method)->search_groups = multisam_search_groups; - (*pdb_method)->search_aliases = multisam_search_aliases; - data = talloc(*pdb_method, struct multisam_data); (*pdb_method)->private_data = data; @@ -439,30 +489,113 @@ data->location = talloc_strdup(data, location); data->names = str_list_make_talloc(data, data->location, NULL); - data->num_backends = str_list_count(data->names); + data->num_backends = str_list_count((const char **)data->names); data->locations = talloc_array(data, char *, data->num_backends); for (i = 0; i < data->num_backends; i++) { - struct pdb_init_function_entry *entry; + struct pdb_init_function_entry *entry = NULL; data->locations[i] = strchr(data->names[i], ':'); if (data->locations[i]) { - data->locations[i] = '\0'; + *(data->locations[i]) = '\0'; data->locations[i]++; + DEBUG(5,("Got location: %s\n", data->locations[i])); } entry = pdb_find_backend_entry(data->names[i]); if (!entry) { + DEBUG(2,("No builtin backend found, trying to load plugin\n")); + if(NT_STATUS_IS_OK(smb_probe_module("pdb", data->names[i])) && !(entry = pdb_find_backend_entry(data->names[i]))) { + DEBUG(0,("Plugin is available, but doesn't register passdb backend %s\n", data->names[i])); + return NT_STATUS_UNSUCCESSFUL; + } + } + if (!entry) { 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; } + + /* Optional.. only set if implemented */ + if (*(data->methods[i])->update_login_attempts != (*pdb_method)->update_login_attempts) + (*pdb_method)->update_login_attempts = multisam_update_login_attempts; + if (*(data->methods[i])->create_user != (*pdb_method)->create_user) + (*pdb_method)->create_user = multisam_create_user; + if (*(data->methods[i])->delete_user != (*pdb_method)->delete_user) + (*pdb_method)->delete_user = multisam_delete_user; + if (*(data->methods[i])->getgrsid != (*pdb_method)->getgrsid) + (*pdb_method)->getgrsid = multisam_getgrsid; + if (*(data->methods[i])->getgrgid != (*pdb_method)->getgrgid) + (*pdb_method)->getgrgid = multisam_getgrgid; + if (*(data->methods[i])->getgrnam != (*pdb_method)->getgrnam) + (*pdb_method)->getgrnam = multisam_getgrnam; + if (*(data->methods[i])->create_dom_group != (*pdb_method)->create_dom_group) + (*pdb_method)->create_dom_group = multisam_create_dom_group; + if (*(data->methods[i])->delete_dom_group != (*pdb_method)->delete_dom_group) + (*pdb_method)->delete_dom_group = multisam_delete_dom_group; + if (*(data->methods[i])->add_group_mapping_entry != (*pdb_method)->add_group_mapping_entry) + (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; + if (*(data->methods[i])->update_group_mapping_entry != (*pdb_method)->update_group_mapping_entry) + (*pdb_method)->update_group_mapping_entry = multisam_update_group_mapping_entry; + if (*(data->methods[i])->delete_group_mapping_entry != (*pdb_method)->delete_group_mapping_entry) + (*pdb_method)->delete_group_mapping_entry = multisam_delete_group_mapping_entry; + if (*(data->methods[i])->enum_group_mapping != (*pdb_method)->enum_group_mapping) + (*pdb_method)->enum_group_mapping = multisam_enum_group_mapping; + if (*(data->methods[i])->enum_group_members != (*pdb_method)->enum_group_members) + (*pdb_method)->enum_group_members = multisam_enum_group_members; + if (*(data->methods[i])->enum_group_memberships != (*pdb_method)->enum_group_memberships) + (*pdb_method)->enum_group_memberships = multisam_enum_group_memberships; + if (*(data->methods[i])->set_unix_primary_group != (*pdb_method)->set_unix_primary_group) + (*pdb_method)->set_unix_primary_group = multisam_set_unix_primary_group; + if (*(data->methods[i])->add_groupmem != (*pdb_method)->add_groupmem) + (*pdb_method)->add_groupmem = multisam_add_groupmem; + if (*(data->methods[i])->del_groupmem != (*pdb_method)->del_groupmem) + (*pdb_method)->del_groupmem = multisam_del_groupmem; + if (*(data->methods[i])->find_alias != (*pdb_method)->find_alias) + (*pdb_method)->find_alias = multisam_find_alias; + if (*(data->methods[i])->create_alias != (*pdb_method)->create_alias) + (*pdb_method)->create_alias = multisam_create_alias; + if (*(data->methods[i])->delete_alias != (*pdb_method)->delete_alias) + (*pdb_method)->delete_alias = multisam_delete_alias; + if (*(data->methods[i])->get_aliasinfo != (*pdb_method)->get_aliasinfo) + (*pdb_method)->get_aliasinfo = multisam_get_aliasinfo; + if (*(data->methods[i])->set_aliasinfo != (*pdb_method)->set_aliasinfo) + (*pdb_method)->set_aliasinfo = multisam_set_aliasinfo; + if (*(data->methods[i])->add_aliasmem != (*pdb_method)->add_aliasmem) + (*pdb_method)->add_aliasmem = multisam_add_aliasmem; + if (*(data->methods[i])->del_aliasmem != (*pdb_method)->del_aliasmem) + (*pdb_method)->del_aliasmem = multisam_del_aliasmem; + if (*(data->methods[i])->enum_aliasmem != (*pdb_method)->enum_aliasmem) + (*pdb_method)->enum_aliasmem = multisam_enum_aliasmem; + if (*(data->methods[i])->enum_alias_memberships != (*pdb_method)->enum_alias_memberships) + (*pdb_method)->enum_alias_memberships = multisam_alias_memberships; + if (*(data->methods[i])->lookup_rids != (*pdb_method)->lookup_rids) + (*pdb_method)->lookup_rids = multisam_lookup_rids; + if (*(data->methods[i])->get_account_policy != (*pdb_method)->get_account_policy) + (*pdb_method)->get_account_policy = multisam_get_account_policy; + if (*(data->methods[i])->set_account_policy != (*pdb_method)->set_account_policy) + (*pdb_method)->set_account_policy = multisam_set_account_policy; + if (*(data->methods[i])->get_seq_num != (*pdb_method)->get_seq_num) + (*pdb_method)->get_seq_num = multisam_get_seq_num; + if (*(data->methods[i])->uid_to_rid != (*pdb_method)->uid_to_rid) + (*pdb_method)->uid_to_rid = multisam_uid_to_rid; + if (*(data->methods[i])->gid_to_sid != (*pdb_method)->gid_to_sid) + (*pdb_method)->gid_to_sid = multisam_gid_to_sid; + if (*(data->methods[i])->sid_to_id != (*pdb_method)->sid_to_id) + (*pdb_method)->sid_to_id = multisam_sid_to_id; + if (*(data->methods[i])->search_users != (*pdb_method)->search_users) + (*pdb_method)->search_users = multisam_search_users; + if (*(data->methods[i])->search_groups != (*pdb_method)->search_groups) + (*pdb_method)->search_groups = multisam_search_groups; + if (*(data->methods[i])->search_aliases != (*pdb_method)->search_aliases) + (*pdb_method)->search_aliases = multisam_search_aliases; } - return NT_STATUS_OK; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ctr...@us...> - 2006-03-24 18:44:50
|
Revision: 47 Author: ctrlsoft Date: 2006-03-24 10:44:44 -0800 (Fri, 24 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=47&view=rev Log Message: ----------- Complete init function Modified Paths: -------------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c 2006-03-24 18:14:31 UTC (rev 46) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-24 18:44:44 UTC (rev 47) @@ -26,10 +26,10 @@ typedef struct multisam_data { const char *location; - struct multisam_backend { - const char *location; - struct pdb_methods *methods; - } *backends; + int num_backends; + char **names; + char **locations; + struct pdb_methods **methods; } multisam_data; static BOOL multisam_search_groups(struct pdb_methods *methods, @@ -365,6 +365,7 @@ static NTSTATUS multisam_init(struct pdb_methods **pdb_method, const char *location) { NTSTATUS nt_status; + int i; struct multisam_data *data; multisam_debug_level = debug_add_class("multisam"); @@ -437,8 +438,31 @@ } data->location = talloc_strdup(data, location); - /* FIXME: parse location */ + data->names = str_list_make_talloc(data, data->location, NULL); + data->num_backends = str_list_count(data->names); + data->locations = talloc_array(data, char *, data->num_backends); + for (i = 0; i < data->num_backends; i++) { + struct pdb_init_function_entry *entry; + + data->locations[i] = strchr(data->names[i], ':'); + if (data->locations[i]) { + data->locations[i] = '\0'; + data->locations[i]++; + } + + entry = pdb_find_backend_entry(data->names[i]); + if (!entry) { + DEBUG(0, ("Unable to find multisam backend %d: %s\n", i, data->names[i])); + return NT_STATUS_UNSUCCESSFUL; + } + + nt_status = entry->init(&data->methods[i], data->locations[i]); + if (NT_STATUS_IS_ERR(nt_status)) { + return nt_status; + } + } + return NT_STATUS_OK; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ctr...@us...> - 2006-03-24 18:14:41
|
Revision: 46 Author: ctrlsoft Date: 2006-03-24 10:14:31 -0800 (Fri, 24 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=46&view=rev Log Message: ----------- Add start of a backend to support multiple backends (-: Modified Paths: -------------- trunk/samba-pdbsql/Makefile.in Added Paths: ----------- trunk/samba-pdbsql/pdb_multi.c Modified: trunk/samba-pdbsql/Makefile.in =================================================================== --- trunk/samba-pdbsql/Makefile.in 2006-03-23 22:56:09 UTC (rev 45) +++ trunk/samba-pdbsql/Makefile.in 2006-03-24 18:14:31 UTC (rev 46) @@ -24,6 +24,9 @@ pgsql.$(SHLIBEXT): pdb_pgsql.o pdb_sql.o $(CC) -shared -o $@ $^ $(PGSQL_LIBS) +multi.$(SHLIBEXT): pdb_multi.o + $(CC) -shared -o $@ $^ + Makefile: Makefile.in config.status ./config.status Added: trunk/samba-pdbsql/pdb_multi.c =================================================================== --- trunk/samba-pdbsql/pdb_multi.c (rev 0) +++ trunk/samba-pdbsql/pdb_multi.c 2006-03-24 18:14:31 UTC (rev 46) @@ -0,0 +1,448 @@ +/* + * Support for multiple password databases + * Copyright (C) Jelmer Vernooij 2006 + * + * 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 2 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. + */ + +#include "includes.h" + +static int multisam_debug_level = DBGC_ALL; + +#undef DBGC_CLASS +#define DBGC_CLASS multisam_debug_level + +typedef struct multisam_data { + const char *location; + struct multisam_backend { + const char *location; + struct pdb_methods *methods; + } *backends; +} multisam_data; + +static BOOL multisam_search_groups(struct pdb_methods *methods, + struct pdb_search *search) +{ + return False; +} + +static BOOL multisam_search_aliases(struct pdb_methods *methods, + struct pdb_search *search, + const DOM_SID *sid) +{ + return False; +} + +static BOOL multisam_search_users(struct pdb_methods *methods, + struct pdb_search *search, + uint32 acct_flags) +{ + return False; +} + + +static NTSTATUS multisam_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_set_account_policy(struct pdb_methods *methods, int policy_index, uint32 value) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_get_seq_num(struct pdb_methods *methods, time_t *seq_num) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static BOOL multisam_uid_to_rid(struct pdb_methods *methods, uid_t uid, + uint32 *rid) +{ + return False; +} + +static BOOL multisam_gid_to_sid(struct pdb_methods *methods, gid_t gid, + DOM_SID *sid) +{ + return False; +} + +static BOOL multisam_sid_to_id(struct pdb_methods *methods, + const DOM_SID *sid, + union unid_t *id, enum SID_NAME_USE *type) +{ + return False; +} + + +static NTSTATUS multisam_set_unix_primary_group(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + struct samu *sampass) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS multisam_create_user(struct pdb_methods *methods, + TALLOC_CTX *tmp_ctx, const char *name, + uint32 acb_info, uint32 *rid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_delete_user(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + struct samu *sam_acct) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_enum_group_memberships(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + struct samu *user, + DOM_SID **pp_sids, + gid_t **pp_gids, + size_t *p_num_groups) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS multisam_enum_group_members(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + const DOM_SID *group, + uint32 **pp_member_rids, + size_t *p_num_members) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS multisam_delete_dom_group(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + uint32 rid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS multisam_rename_sam_account (struct pdb_methods *methods, struct samu *pwd, const char *newname) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_update_login_attempts (struct pdb_methods *methods, struct samu *newpwd, BOOL success) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map, + DOM_SID sid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_getgrgid(struct pdb_methods *methods, GROUP_MAP *map, + gid_t gid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_getgrnam(struct pdb_methods *methods, GROUP_MAP *map, + const char *name) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_add_group_mapping_entry(struct pdb_methods *methods, + GROUP_MAP *map) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_update_group_mapping_entry(struct pdb_methods *methods, + GROUP_MAP *map) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_delete_group_mapping_entry(struct pdb_methods *methods, + DOM_SID sid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_enum_group_mapping(struct pdb_methods *methods, + const DOM_SID *sid, enum SID_NAME_USE sid_name_use, + GROUP_MAP **pp_rmap, size_t *p_num_entries, + BOOL unix_only) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_find_alias(struct pdb_methods *methods, + const char *name, DOM_SID *sid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_create_alias(struct pdb_methods *methods, + const char *name, uint32 *rid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_delete_alias(struct pdb_methods *methods, + const DOM_SID *sid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_get_aliasinfo(struct pdb_methods *methods, + const DOM_SID *sid, + struct acct_info *info) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_set_aliasinfo(struct pdb_methods *methods, + const DOM_SID *sid, + struct acct_info *info) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_add_aliasmem(struct pdb_methods *methods, + const DOM_SID *alias, const DOM_SID *member) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_del_aliasmem(struct pdb_methods *methods, + const DOM_SID *alias, const DOM_SID *member) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS multisam_enum_aliasmem(struct pdb_methods *methods, + const DOM_SID *alias, DOM_SID **pp_members, + size_t *p_num_members) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_alias_memberships(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + const DOM_SID *members, + size_t num_members, + uint32 **pp_alias_rids, + size_t *p_num_alias_rids) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS multisam_setsampwent(struct pdb_methods *methods, BOOL update, uint32 acb_mask) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +/*************************************************************** + End enumeration of the passwd list. + ****************************************************************/ + +static void multisam_endsampwent(struct pdb_methods *methods) +{ + +} + +/***************************************************************** + Get one struct samu from the list (next in line) + *****************************************************************/ + +static NTSTATUS multisam_getsampwent(struct pdb_methods *methods, struct samu * user) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +/****************************************************************** + Lookup a name in the SAM database + ******************************************************************/ + +static NTSTATUS multisam_getsampwnam(struct pdb_methods *methods, struct samu * user, + const char *sname) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/*************************************************************************** + Search by sid + **************************************************************************/ + +static NTSTATUS multisam_getsampwsid(struct pdb_methods *methods, struct samu * user, + const DOM_SID * sid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +/*************************************************************************** + Delete a sam account + ****************************************************************************/ + +static NTSTATUS multisam_delete_sam_account(struct pdb_methods *methods, + struct samu * sam_pass) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_replace_sam_account(struct pdb_methods *methods, + struct samu * newpwd, char isupdate) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_add_sam_account(struct pdb_methods *methods, struct samu * newpwd) +{ + return multisam_replace_sam_account(methods, newpwd, 0); +} + +static NTSTATUS multisam_update_sam_account(struct pdb_methods *methods, + struct samu * newpwd) +{ + return multisam_replace_sam_account(methods, newpwd, 1); +} + +static NTSTATUS multisam_lookup_rids(struct pdb_methods *methods, + const 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) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_add_groupmem(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + uint32 group_rid, + uint32 member_rid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS multisam_del_groupmem(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + uint32 group_rid, + uint32 member_rid) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS multisam_init(struct pdb_methods **pdb_method, const char *location) +{ + NTSTATUS nt_status; + struct multisam_data *data; + + multisam_debug_level = debug_add_class("multisam"); + if (multisam_debug_level == -1) { + multisam_debug_level = DBGC_ALL; + DEBUG(0, + ("multisam: Couldn't register custom debugging class!\n")); + } + + if ( !NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method )) ) { + return nt_status; + } + + (*pdb_method)->name = "multisam"; + + (*pdb_method)->setsampwent = multisam_setsampwent; + (*pdb_method)->endsampwent = multisam_endsampwent; + (*pdb_method)->getsampwent = multisam_getsampwent; + (*pdb_method)->getsampwnam = multisam_getsampwnam; + (*pdb_method)->getsampwsid = multisam_getsampwsid; + (*pdb_method)->create_user = multisam_create_user; + (*pdb_method)->delete_user = multisam_delete_user; + (*pdb_method)->add_sam_account = multisam_add_sam_account; + (*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; + (*pdb_method)->update_login_attempts = multisam_update_login_attempts; + + (*pdb_method)->getgrsid = multisam_getgrsid; + (*pdb_method)->getgrgid = multisam_getgrgid; + (*pdb_method)->getgrnam = multisam_getgrnam; + (*pdb_method)->create_dom_group = multisam_create_dom_group; + (*pdb_method)->delete_dom_group = multisam_delete_dom_group; + (*pdb_method)->add_group_mapping_entry = multisam_add_group_mapping_entry; + (*pdb_method)->update_group_mapping_entry = multisam_update_group_mapping_entry; + (*pdb_method)->delete_group_mapping_entry = multisam_delete_group_mapping_entry; + (*pdb_method)->enum_group_mapping = multisam_enum_group_mapping; + (*pdb_method)->enum_group_members = multisam_enum_group_members; + (*pdb_method)->enum_group_memberships = multisam_enum_group_memberships; + (*pdb_method)->set_unix_primary_group = multisam_set_unix_primary_group; + (*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; + (*pdb_method)->set_aliasinfo = multisam_set_aliasinfo; + (*pdb_method)->add_aliasmem = multisam_add_aliasmem; + (*pdb_method)->del_aliasmem = multisam_del_aliasmem; + (*pdb_method)->enum_aliasmem = multisam_enum_aliasmem; + (*pdb_method)->enum_alias_memberships = multisam_alias_memberships; + (*pdb_method)->lookup_rids = multisam_lookup_rids; + (*pdb_method)->get_account_policy = multisam_get_account_policy; + (*pdb_method)->set_account_policy = multisam_set_account_policy; + (*pdb_method)->get_seq_num = multisam_get_seq_num; + (*pdb_method)->uid_to_rid = multisam_uid_to_rid; + (*pdb_method)->gid_to_sid = multisam_gid_to_sid; + (*pdb_method)->sid_to_id = multisam_sid_to_id; + + (*pdb_method)->search_users = multisam_search_users; + (*pdb_method)->search_groups = multisam_search_groups; + (*pdb_method)->search_aliases = multisam_search_aliases; + + data = talloc(*pdb_method, struct multisam_data); + (*pdb_method)->private_data = data; + + if (!location) { + DEBUG(0, ("No identifier specified. Check the Samba HOWTO Collection for details\n")); + return NT_STATUS_INVALID_PARAMETER; + } + + data->location = talloc_strdup(data, location); + /* FIXME: parse location */ + + return NT_STATUS_OK; +} + +NTSTATUS init_module(void) +{ + return smb_register_passdb(PASSDB_INTERFACE_VERSION, "multi", multisam_init); +} Property changes on: trunk/samba-pdbsql/pdb_multi.c ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ctr...@us...> - 2006-03-23 22:56:14
|
Revision: 45 Author: ctrlsoft Date: 2006-03-23 14:56:09 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=45&view=rev Log Message: ----------- Install examples only into the relevant packages. Modified Paths: -------------- trunk/samba-pdbsql/debian/rules Modified: trunk/samba-pdbsql/debian/rules =================================================================== --- trunk/samba-pdbsql/debian/rules 2006-03-23 22:48:37 UTC (rev 44) +++ trunk/samba-pdbsql/debian/rules 2006-03-23 22:56:09 UTC (rev 45) @@ -24,9 +24,11 @@ dh_installdirs $(MAKE) install DESTDIR=`pwd`/debian/tmp LIBDIR=/usr/lib/samba dh_install --sourcedir=`pwd`/debian/tmp - dh_installdocs -a docs/README docs/pdb_mysql.xml + dh_installdocs -p samba-pdb-pgsql AUTHORS docs/README + dh_installdocs -p samba-pdb-mysql docs/pdb_mysql.html AUTHORS docs/README dh_installchangelogs -a - dh_installexamples -a docs/smb.conf.mysql docs/mysql.dump docs/smb.conf.pgsql docs/pgsql.dump + 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_compress -a dh_fixperms -a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ctr...@us...> - 2006-03-23 22:48:42
|
Revision: 44 Author: ctrlsoft Date: 2006-03-23 14:48:37 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=44&view=rev Log Message: ----------- Use default port number as defined in postgresqls' headers Modified Paths: -------------- trunk/samba-pdbsql/pdb_pgsql.c Modified: trunk/samba-pdbsql/pdb_pgsql.c =================================================================== --- trunk/samba-pdbsql/pdb_pgsql.c 2006-03-23 22:44:31 UTC (rev 43) +++ trunk/samba-pdbsql/pdb_pgsql.c 2006-03-23 22:48:37 UTC (rev 44) @@ -1,7 +1,7 @@ /* * PostgresSQL password backend for samba * Copyright (C) Hamish Friedlander 2003 - * Copyright (C) Jelmer Vernooij 2004 + * Copyright (C) Jelmer Vernooij 2004-2006 * Copyright (C) Wilco Baan Hofman 2006 * * This program is free software; you can redistribute it and/or modify it under @@ -22,10 +22,18 @@ #include "pdb_sql.h" #include <libpq-fe.h> +/* To prevent duplicate defines */ +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_VERSION +#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 "5433" +#define CONFIG_PORT_DEFAULT DEF_PGPORT_STR #define CONFIG_DB_DEFAULT "samba" /* handles for doing db transactions */ @@ -588,7 +596,7 @@ data->user = config_value( data, "pgsql user" , CONFIG_USER_DEFAULT ); data->pass = config_value( data, "pgsql password", CONFIG_PASS_DEFAULT ); - DEBUG( 5, ("Pgsql module intialized\n") ) ; + DEBUG( 5, ("Pgsql module initialized\n") ) ; return NT_STATUS_OK; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-23 22:44:36
|
Revision: 43 Author: synnack Date: 2006-03-23 14:44:31 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=43&view=rev Log Message: ----------- postgresql sample smb.conf didn't work with the the sample dump. Modified Paths: -------------- trunk/samba-pdbsql/docs/smb.conf.pgsql Modified: trunk/samba-pdbsql/docs/smb.conf.pgsql =================================================================== --- trunk/samba-pdbsql/docs/smb.conf.pgsql 2006-03-23 22:42:19 UTC (rev 42) +++ trunk/samba-pdbsql/docs/smb.conf.pgsql 2006-03-23 22:44:31 UTC (rev 43) @@ -10,3 +10,4 @@ pgsql:pgsql password = ambas pgsql:pgsql database = samba pgsql:pgsql port = 5433 +pgsql:table = users This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-23 22:42:26
|
Revision: 42 Author: synnack Date: 2006-03-23 14:42:19 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=42&view=rev Log Message: ----------- Added sample configuration files for postgresql. Modified Paths: -------------- trunk/samba-pdbsql/debian/rules Added Paths: ----------- trunk/samba-pdbsql/docs/pgsql.dump trunk/samba-pdbsql/docs/smb.conf.pgsql Modified: trunk/samba-pdbsql/debian/rules =================================================================== --- trunk/samba-pdbsql/debian/rules 2006-03-23 22:33:25 UTC (rev 41) +++ trunk/samba-pdbsql/debian/rules 2006-03-23 22:42:19 UTC (rev 42) @@ -26,7 +26,7 @@ dh_install --sourcedir=`pwd`/debian/tmp dh_installdocs -a docs/README docs/pdb_mysql.xml dh_installchangelogs -a - dh_installexamples -a docs/smb.conf.mysql docs/mysql.dump + dh_installexamples -a docs/smb.conf.mysql docs/mysql.dump docs/smb.conf.pgsql docs/pgsql.dump dh_installman -a dh_compress -a dh_fixperms -a Added: trunk/samba-pdbsql/docs/pgsql.dump =================================================================== --- trunk/samba-pdbsql/docs/pgsql.dump (rev 0) +++ trunk/samba-pdbsql/docs/pgsql.dump 2006-03-23 22:42:19 UTC (rev 42) @@ -0,0 +1,35 @@ +CREATE TABLE users ( + logon_time integer default NULL, + logoff_time integer default NULL, + kickoff_time integer default NULL, + pass_last_set_time integer default NULL, + pass_can_change_time integer default '0', + pass_must_change_time integer default '2147483647', + username varchar(255) default NULL, + domain varchar(255) default NULL, + nt_username varchar(255) default NULL, + nt_fullname varchar(255) default NULL, + home_dir varchar(255) default NULL, + dir_drive varchar(4) default NULL, + logon_script varchar(255) default NULL, + profile_path varchar(255) default NULL, + acct_desc varchar(255) default NULL, + workstations varchar(255) default NULL, + unknown_str varchar(255) default NULL, + munged_dial varchar(255) default NULL, + uid SERIAL NOT NULL PRIMARY KEY, + gid integer default NULL, + user_sid varchar(255) default NULL, + group_sid varchar(255) default NULL, + lm_pw varchar(255) default NULL, + nt_pw varchar(255) default NULL, + acct_ctrl integer default '528', + logon_divs integer default '168', + hours_len integer default '21', + unknown_6 integer default '1260', + bad_password_count integer default NULL, + logon_count integer default '0', + logon_hours varchar(42) default NULL, + UNIQUE (username), + UNIQUE (nt_username) +); Added: trunk/samba-pdbsql/docs/smb.conf.pgsql =================================================================== --- trunk/samba-pdbsql/docs/smb.conf.pgsql (rev 0) +++ trunk/samba-pdbsql/docs/smb.conf.pgsql 2006-03-23 22:42:19 UTC (rev 42) @@ -0,0 +1,12 @@ +[global] +netbios name = FOOBAR +workgroup = TESTGROUP +security = domain +domain logons = yes +domain master = yes +passdb backend = plugin:/usr/local/samba/lib/pdb_pgsql.so:pgsql +pgsql:pgsql host = localhost +pgsql:pgsql user = samba +pgsql:pgsql password = ambas +pgsql:pgsql database = samba +pgsql:pgsql port = 5433 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sy...@us...> - 2006-03-23 22:33:30
|
Revision: 41 Author: synnack Date: 2006-03-23 14:33:25 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=41&view=rev Log Message: ----------- * Made pgsql compatible with new passdb: * new_rid function * rid_algorithm function * Using make_pdb_method to create pdb_methods (fixes segfault on startup). * Changed default port from 5432 to 5433 (postgresql 8 default) Modified Paths: -------------- trunk/samba-pdbsql/pdb_pgsql.c Modified: trunk/samba-pdbsql/pdb_pgsql.c =================================================================== --- trunk/samba-pdbsql/pdb_pgsql.c 2006-03-23 21:26:17 UTC (rev 40) +++ trunk/samba-pdbsql/pdb_pgsql.c 2006-03-23 22:33:25 UTC (rev 41) @@ -2,6 +2,7 @@ * PostgresSQL password backend for samba * Copyright (C) Hamish Friedlander 2003 * Copyright (C) Jelmer Vernooij 2004 + * Copyright (C) Wilco Baan Hofman 2006 * * 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 @@ -24,7 +25,7 @@ #define CONFIG_HOST_DEFAULT "localhost" #define CONFIG_USER_DEFAULT "samba" #define CONFIG_PASS_DEFAULT "" -#define CONFIG_PORT_DEFAULT "5432" +#define CONFIG_PORT_DEFAULT "5433" #define CONFIG_DB_DEFAULT "samba" /* handles for doing db transactions */ @@ -526,63 +527,72 @@ return pgsqlsam_replace_sam_account( methods, newpwd, 1 ) ; } +static BOOL pgsqlsam_rid_algorithm (struct pdb_methods *pdb_methods) { + return False; +} +static BOOL pgsqlsam_new_rid (struct pdb_methods *pdb_methods, uint32 *rid) { + *rid = 0; + return True; +} + static NTSTATUS pgsqlsam_init (struct pdb_methods **pdb_method, const char *location ) { - struct pdb_pgsql_data *data = malloc_p(struct pdb_pgsql_data); + NTSTATUS nt_status; + struct pdb_pgsql_data *data = malloc_p(struct pdb_pgsql_data); + + if ( !NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method )) ) { + return nt_status; + } - (*pdb_method)->name = "pgsqlsam"; + (*pdb_method)->name = "pgsqlsam"; - (*pdb_method)->setsampwent = pgsqlsam_setsampwent; - (*pdb_method)->endsampwent = pgsqlsam_endsampwent; - (*pdb_method)->getsampwent = pgsqlsam_getsampwent; - (*pdb_method)->getsampwnam = pgsqlsam_getsampwnam; - (*pdb_method)->getsampwsid = pgsqlsam_getsampwsid; - (*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; + (*pdb_method)->setsampwent = pgsqlsam_setsampwent; + (*pdb_method)->endsampwent = pgsqlsam_endsampwent; + (*pdb_method)->getsampwent = pgsqlsam_getsampwent; + (*pdb_method)->getsampwnam = pgsqlsam_getsampwnam; + (*pdb_method)->getsampwsid = pgsqlsam_getsampwsid; + (*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; + (*pdb_method)->rid_algorithm = pgsqlsam_rid_algorithm; + (*pdb_method)->new_rid = pgsqlsam_new_rid; - (*pdb_method)->private_data = data; + + (*pdb_method)->private_data = data; - data->master_handle = NULL; - data->handle = NULL; - data->pwent = NULL ; + data->master_handle = NULL; + data->handle = NULL; + data->pwent = NULL ; - if ( !location ) - { - DEBUG( 0, ("No identifier specified. Check the Samba HOWTO Collection for details\n") ) ; - return NT_STATUS_INVALID_PARAMETER; - } + if ( !location ) { + DEBUG( 0, ("No identifier specified. Check the Samba HOWTO Collection for details\n") ) ; + return NT_STATUS_INVALID_PARAMETER; + } - data->location = smb_xstrdup( location ) ; + data->location = smb_xstrdup( location ) ; - if(!sql_account_config_valid(data->location)) { - return NT_STATUS_INVALID_PARAMETER; - } + if(!sql_account_config_valid(data->location)) { + return NT_STATUS_INVALID_PARAMETER; + } - DEBUG - ( - 1, - ( - "Database server parameters: host: %s, user: %s, password: XXXX, database: %s, port: %s\n", - config_value( data, "pgsql host" , CONFIG_HOST_DEFAULT ), - config_value( data, "pgsql user" , CONFIG_USER_DEFAULT ), - config_value( data, "pgsql database", CONFIG_DB_DEFAULT ), - config_value( data, "pgsql port" , CONFIG_PORT_DEFAULT ) - ) - ) ; + DEBUG(1, ( "Database server parameters: host: %s, user: %s, password: XXXX, database: %s, port: %s\n", + config_value( data, "pgsql host" , CONFIG_HOST_DEFAULT ), + config_value( data, "pgsql user" , CONFIG_USER_DEFAULT ), + config_value( data, "pgsql database", CONFIG_DB_DEFAULT ), + config_value( data, "pgsql port" , CONFIG_PORT_DEFAULT ))); - /* Save the parameters. */ - data->db = config_value( data, "pgsql database", CONFIG_DB_DEFAULT ); - data->host = config_value( data, "pgsql host" , CONFIG_HOST_DEFAULT ); - data->port = config_value( data, "pgsql port" , CONFIG_PORT_DEFAULT ); - data->user = config_value( data, "pgsql user" , CONFIG_USER_DEFAULT ); - data->pass = config_value( data, "pgsql password", CONFIG_PASS_DEFAULT ); + /* Save the parameters. */ + data->db = config_value( data, "pgsql database", CONFIG_DB_DEFAULT ); + data->host = config_value( data, "pgsql host" , CONFIG_HOST_DEFAULT ); + data->port = config_value( data, "pgsql port" , CONFIG_PORT_DEFAULT ); + data->user = config_value( data, "pgsql user" , CONFIG_USER_DEFAULT ); + data->pass = config_value( data, "pgsql password", CONFIG_PASS_DEFAULT ); - DEBUG( 5, ("Pgsql module intialized\n") ) ; - return NT_STATUS_OK; + DEBUG( 5, ("Pgsql module intialized\n") ) ; + return NT_STATUS_OK; } -NTSTATUS init_module(void) +NTSTATUS init_module(void) { - return smb_register_passdb( PASSDB_INTERFACE_VERSION, "pgsql", pgsqlsam_init ) ; + return smb_register_passdb( PASSDB_INTERFACE_VERSION, "pgsql", pgsqlsam_init ) ; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ctr...@us...> - 2006-03-23 21:26:22
|
Revision: 40 Author: ctrlsoft Date: 2006-03-23 13:26:17 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=40&view=rev Log Message: ----------- Fix init functions Modified Paths: -------------- trunk/samba-pdbsql/pdb_mysql.c trunk/samba-pdbsql/pdb_pgsql.c Modified: trunk/samba-pdbsql/pdb_mysql.c =================================================================== --- trunk/samba-pdbsql/pdb_mysql.c 2006-03-23 20:14:17 UTC (rev 39) +++ trunk/samba-pdbsql/pdb_mysql.c 2006-03-23 21:26:17 UTC (rev 40) @@ -22,8 +22,6 @@ #include <mysql.h> #include <errmsg.h> -#define pdb_mysql_init init_module - #define CONFIG_HOST_DEFAULT "localhost" #define CONFIG_USER_DEFAULT "samba" #define CONFIG_PASS_DEFAULT "" @@ -579,7 +577,7 @@ return NT_STATUS_OK; } -NTSTATUS pdb_mysql_init(void) +NTSTATUS init_module(void) { return smb_register_passdb(PASSDB_INTERFACE_VERSION, "mysql", mysqlsam_init); } Modified: trunk/samba-pdbsql/pdb_pgsql.c =================================================================== --- trunk/samba-pdbsql/pdb_pgsql.c 2006-03-23 20:14:17 UTC (rev 39) +++ trunk/samba-pdbsql/pdb_pgsql.c 2006-03-23 21:26:17 UTC (rev 40) @@ -582,7 +582,7 @@ return NT_STATUS_OK; } -NTSTATUS pdb_pgsql_init(void) +NTSTATUS init_module(void) { return smb_register_passdb( PASSDB_INTERFACE_VERSION, "pgsql", pgsqlsam_init ) ; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ctr...@us...> - 2006-03-23 20:14:22
|
Revision: 39 Author: ctrlsoft Date: 2006-03-23 12:14:17 -0800 (Thu, 23 Mar 2006) ViewCVS: http://svn.sourceforge.net/pdbsql/?rev=39&view=rev Log Message: ----------- Add simple makefile for generating the docs Added Paths: ----------- trunk/samba-pdbsql/docs/Makefile Property Changed: ---------------- trunk/samba-pdbsql/docs/ Property changes on: trunk/samba-pdbsql/docs ___________________________________________________________________ Name: svn:ignore + pdb_mysql.html Added: trunk/samba-pdbsql/docs/Makefile =================================================================== --- trunk/samba-pdbsql/docs/Makefile (rev 0) +++ trunk/samba-pdbsql/docs/Makefile 2006-03-23 20:14:17 UTC (rev 39) @@ -0,0 +1,6 @@ +XMLTO = xmlto + +all: pdb_mysql.html + +%.html: %.xml + $(XMLTO) html-nochunks $< Property changes on: trunk/samba-pdbsql/docs/Makefile ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |