diff options
author | Gerald Carter <jerry@samba.org> | 2007-01-24 01:48:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:17:23 -0500 |
commit | b9b26be1744b792a54f0a77af140237b4dc5a870 (patch) | |
tree | 96501a60f415248f226902f790420dec7758a540 /source3/libads | |
parent | 78f5f4b260d877ce615dbbdc2bccbb0cd251f08a (diff) | |
download | samba-b9b26be1744b792a54f0a77af140237b4dc5a870.tar.gz samba-b9b26be1744b792a54f0a77af140237b4dc5a870.tar.bz2 samba-b9b26be1744b792a54f0a77af140237b4dc5a870.zip |
r20986: Commit the prototype of the nss_info plugin interface.
This allows a provider to supply the homedirectory, etc...
attributes for a user without requiring support in core
winbindd code. The idmap_ad.c module has been modified
to provide the idmap 'ad' library as well as the rfc2307 and sfu
"winbind nss info" support.
The SID/id mapping is working in idmap_ad but the nss_info
still has a few quirks that I'm in the process of resolving.
(This used to be commit aaec0115e2c96935499052d9a637a20c6445986e)
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/ads_struct.c | 6 | ||||
-rw-r--r-- | source3/libads/ldap_schema.c | 77 |
2 files changed, 32 insertions, 51 deletions
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c index 545995ddcc..05f066c9fa 100644 --- a/source3/libads/ads_struct.c +++ b/source3/libads/ads_struct.c @@ -161,12 +161,6 @@ void ads_destroy(ADS_STRUCT **ads) SAFE_FREE((*ads)->config.server_site_name); SAFE_FREE((*ads)->config.client_site_name); - SAFE_FREE((*ads)->schema.posix_uidnumber_attr); - SAFE_FREE((*ads)->schema.posix_gidnumber_attr); - SAFE_FREE((*ads)->schema.posix_shell_attr); - SAFE_FREE((*ads)->schema.posix_homedir_attr); - SAFE_FREE((*ads)->schema.posix_gecos_attr); - ZERO_STRUCTP(*ads); if ( is_mine ) diff --git a/source3/libads/ldap_schema.c b/source3/libads/ldap_schema.c index b4a512cbfe..5d91d98549 100644 --- a/source3/libads/ldap_schema.c +++ b/source3/libads/ldap_schema.c @@ -186,7 +186,10 @@ static ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **s * @return ADS_STATUS status of search (False if one or more attributes couldn't be * found in Active Directory) **/ -ADS_STATUS ads_check_posix_schema_mapping(ADS_STRUCT *ads, enum wb_posix_mapping map_type) +ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx, + ADS_STRUCT *ads, + enum wb_posix_mapping map_type, + struct posix_schema **s ) { TALLOC_CTX *ctx = NULL; ADS_STATUS status; @@ -194,6 +197,7 @@ ADS_STATUS ads_check_posix_schema_mapping(ADS_STRUCT *ads, enum wb_posix_mapping size_t num_names; char *schema_path = NULL; int i; + struct posix_schema *schema = NULL; const char *oids_sfu[] = { ADS_ATTR_SFU_UIDNUMBER_OID, ADS_ATTR_SFU_GIDNUMBER_OID, @@ -209,34 +213,15 @@ ADS_STATUS ads_check_posix_schema_mapping(ADS_STRUCT *ads, enum wb_posix_mapping DEBUG(10,("ads_check_posix_schema_mapping\n")); - switch (map_type) { - - case WB_POSIX_MAP_TEMPLATE: - case WB_POSIX_MAP_UNIXINFO: - DEBUG(10,("ads_check_posix_schema_mapping: nothing to do\n")); - return ADS_ERROR(LDAP_SUCCESS); - - case WB_POSIX_MAP_SFU: - case WB_POSIX_MAP_RFC2307: - break; - - default: - DEBUG(0,("ads_check_posix_schema_mapping: " - "unknown enum %d\n", map_type)); - return ADS_ERROR(LDAP_PARAM_ERROR); + if ( (ctx = talloc_init("ads_check_posix_schema_mapping")) == NULL ) { + return ADS_ERROR(LDAP_NO_MEMORY); } - ads->schema.posix_uidnumber_attr = NULL; - ads->schema.posix_gidnumber_attr = NULL; - ads->schema.posix_homedir_attr = NULL; - ads->schema.posix_shell_attr = NULL; - ads->schema.posix_gecos_attr = NULL; - - ctx = talloc_init("ads_check_posix_schema_mapping"); - if (ctx == NULL) { + if ( (schema = TALLOC_P(mem_ctx, struct posix_schema)) == NULL ) { + TALLOC_FREE( ctx ); return ADS_ERROR(LDAP_NO_MEMORY); } - + status = ads_schema_path(ads, ctx, &schema_path); if (!ADS_ERR_OK(status)) { DEBUG(3,("ads_check_posix_mapping: Unable to retrieve schema DN!\n")); @@ -257,10 +242,7 @@ ADS_STATUS ads_check_posix_schema_mapping(ADS_STRUCT *ads, enum wb_posix_mapping DEBUG(3,("ads_check_posix_schema_mapping: failed %s\n", ads_errstr(status))); goto done; - } - - DEBUG(10,("ads_check_posix_schema_mapping: query succeeded, identified: %s\n", - wb_posix_map_str(map_type))); + } for (i=0; i<num_names; i++) { @@ -268,43 +250,48 @@ ADS_STATUS ads_check_posix_schema_mapping(ADS_STRUCT *ads, enum wb_posix_mapping if (strequal(ADS_ATTR_RFC2307_UIDNUMBER_OID, oids_out[i]) || strequal(ADS_ATTR_SFU_UIDNUMBER_OID, oids_out[i])) { - SAFE_FREE(ads->schema.posix_uidnumber_attr); - ads->schema.posix_uidnumber_attr = SMB_STRDUP(names_out[i]); + schema->posix_uidnumber_attr = talloc_strdup(schema, names_out[i]); + continue; } + if (strequal(ADS_ATTR_RFC2307_GIDNUMBER_OID, oids_out[i]) || strequal(ADS_ATTR_SFU_GIDNUMBER_OID, oids_out[i])) { - SAFE_FREE(ads->schema.posix_gidnumber_attr); - ads->schema.posix_gidnumber_attr = SMB_STRDUP(names_out[i]); + schema->posix_gidnumber_attr = talloc_strdup(schema, names_out[i]); + continue; } + if (strequal(ADS_ATTR_RFC2307_HOMEDIR_OID, oids_out[i]) || strequal(ADS_ATTR_SFU_HOMEDIR_OID, oids_out[i])) { - SAFE_FREE(ads->schema.posix_homedir_attr); - ads->schema.posix_homedir_attr = SMB_STRDUP(names_out[i]); + schema->posix_homedir_attr = talloc_strdup(schema, names_out[i]); + continue; } + if (strequal(ADS_ATTR_RFC2307_SHELL_OID, oids_out[i]) || strequal(ADS_ATTR_SFU_SHELL_OID, oids_out[i])) { - SAFE_FREE(ads->schema.posix_shell_attr); - ads->schema.posix_shell_attr = SMB_STRDUP(names_out[i]); + schema->posix_shell_attr = talloc_strdup(schema, names_out[i]); + continue; } + if (strequal(ADS_ATTR_RFC2307_GECOS_OID, oids_out[i]) || strequal(ADS_ATTR_SFU_GECOS_OID, oids_out[i])) { - SAFE_FREE(ads->schema.posix_gecos_attr); - ads->schema.posix_gecos_attr = SMB_STRDUP(names_out[i]); + schema->posix_gecos_attr = talloc_strdup(schema, names_out[i]); } } - if (!ads->schema.posix_uidnumber_attr || - !ads->schema.posix_gidnumber_attr || - !ads->schema.posix_homedir_attr || - !ads->schema.posix_shell_attr || - !ads->schema.posix_gecos_attr) { + if (!schema->posix_uidnumber_attr || + !schema->posix_gidnumber_attr || + !schema->posix_homedir_attr || + !schema->posix_shell_attr || + !schema->posix_gecos_attr) { status = ADS_ERROR(LDAP_NO_MEMORY); + TALLOC_FREE( schema ); goto done; } + + *s = schema; status = ADS_ERROR(LDAP_SUCCESS); - ads->schema.map_type = map_type; done: if (ctx) { talloc_destroy(ctx); |