winbind: remove nss_get_info backend functions
authorVolker Lendecke <vl@samba.org>
Tue, 3 Jan 2017 12:35:15 +0000 (12:35 +0000)
committerVolker Lendecke <vl@samba.org>
Wed, 4 Jan 2017 11:22:13 +0000 (12:22 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/include/nss_info.h
source3/winbindd/idmap_ad_nss.c
source3/winbindd/idmap_hash/idmap_hash.c
source3/winbindd/nss_info_template.c

index b3fb151739b29c2203a37c431e390d5c556cc320..54b4399056af1e69e6eb086f786782714c409323 100644 (file)
@@ -61,11 +61,6 @@ struct nss_domain_entry {
 
 struct nss_info_methods {
        NTSTATUS (*init)( struct nss_domain_entry *e );
-       NTSTATUS (*get_nss_info)( struct nss_domain_entry *e, 
-                                 const struct dom_sid *sid,
-                                 TALLOC_CTX *ctx, 
-                                 const char **homedir, const char **shell,
-                                 const char **gecos, gid_t *p_gid);
        NTSTATUS (*map_to_alias)(TALLOC_CTX *mem_ctx,
                                 struct nss_domain_entry *e,
                                 const char *name, char **alias);
index d979231e88a36a6cdc196678735505828814d113..8b27b36b2caab492a2a2c6f69170c8ca1c8939b0 100644 (file)
@@ -197,109 +197,6 @@ static NTSTATUS nss_rfc2307_init( struct nss_domain_entry *e )
        return nss_ad_generic_init(e, WB_POSIX_MAP_RFC2307);
 }
 
-
-/************************************************************************
- ***********************************************************************/
-
-static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e,
-                                 const struct dom_sid *sid,
-                                 TALLOC_CTX *mem_ctx,
-                                 const char **homedir,
-                                 const char **shell,
-                                 const char **gecos,
-                                 gid_t *p_gid )
-{
-       const char *attrs[] = {NULL, /* attr_homedir */
-                              NULL, /* attr_shell */
-                              NULL, /* attr_gecos */
-                              NULL, /* attr_gidnumber */
-                              NULL };
-       char *filter = NULL;
-       LDAPMessage *msg_internal = NULL;
-       ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
-       NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
-       char *sidstr = NULL;
-       struct idmap_domain *dom;
-       struct idmap_ad_context *ctx;
-
-       DEBUG(10, ("nss_ad_get_info called for sid [%s] in domain '%s'\n",
-                  sid_string_dbg(sid), e->domain?e->domain:"NULL"));
-
-       /* Only do query if we are online */
-       if (idmap_is_offline()) {
-               return NT_STATUS_FILE_IS_OFFLINE;
-       }
-
-       dom = talloc_get_type(e->state, struct idmap_domain);
-       ctx = talloc_get_type(dom->private_data, struct idmap_ad_context);
-
-       ads_status = ad_idmap_cached_connection(dom);
-       if (!ADS_ERR_OK(ads_status)) {
-               return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-       }
-
-       if (!ctx->ad_schema) {
-               DEBUG(10, ("nss_ad_get_info: no ad_schema configured!\n"));
-               return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-       }
-
-       if (!sid || !homedir || !shell || !gecos) {
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       /* Have to do our own query */
-
-       DEBUG(10, ("nss_ad_get_info: no ads connection given, doing our "
-                  "own query\n"));
-
-       attrs[0] = ctx->ad_schema->posix_homedir_attr;
-       attrs[1] = ctx->ad_schema->posix_shell_attr;
-       attrs[2] = ctx->ad_schema->posix_gecos_attr;
-       attrs[3] = ctx->ad_schema->posix_gidnumber_attr;
-
-       sidstr = ldap_encode_ndr_dom_sid(mem_ctx, sid);
-       filter = talloc_asprintf(mem_ctx, "(objectSid=%s)", sidstr);
-       TALLOC_FREE(sidstr);
-
-       if (!filter) {
-               nt_status = NT_STATUS_NO_MEMORY;
-               goto done;
-       }
-
-       ads_status = ads_search_retry(ctx->ads, &msg_internal, filter, attrs);
-       if (!ADS_ERR_OK(ads_status)) {
-               nt_status = ads_ntstatus(ads_status);
-               goto done;
-       }
-
-       *homedir = ads_pull_string(ctx->ads, mem_ctx, msg_internal, ctx->ad_schema->posix_homedir_attr);
-       *shell   = ads_pull_string(ctx->ads, mem_ctx, msg_internal, ctx->ad_schema->posix_shell_attr);
-       *gecos   = ads_pull_string(ctx->ads, mem_ctx, msg_internal, ctx->ad_schema->posix_gecos_attr);
-
-       if (p_gid != NULL) {
-               uint32_t gid = UINT32_MAX;
-               bool ok;
-
-               ok = ads_pull_uint32(ctx->ads, msg_internal,
-                                    ctx->ad_schema->posix_gidnumber_attr,
-                                    &gid);
-               if (ok) {
-                       *p_gid = gid;
-               } else {
-                       *p_gid = (gid_t)-1;
-               }
-       }
-
-       nt_status = NT_STATUS_OK;
-
-done:
-       if (msg_internal) {
-               ads_msgfree(ctx->ads, msg_internal);
-       }
-
-       return nt_status;
-}
-
 /**********************************************************************
  *********************************************************************/
 
@@ -475,21 +372,18 @@ done:
 
 static struct nss_info_methods nss_rfc2307_methods = {
        .init           = nss_rfc2307_init,
-       .get_nss_info   = nss_ad_get_info,
        .map_to_alias   = nss_ad_map_to_alias,
        .map_from_alias = nss_ad_map_from_alias,
 };
 
 static struct nss_info_methods nss_sfu_methods = {
        .init           = nss_sfu_init,
-       .get_nss_info   = nss_ad_get_info,
        .map_to_alias   = nss_ad_map_to_alias,
        .map_from_alias = nss_ad_map_from_alias,
 };
 
 static struct nss_info_methods nss_sfu20_methods = {
        .init           = nss_sfu20_init,
-       .get_nss_info   = nss_ad_get_info,
        .map_to_alias   = nss_ad_map_to_alias,
        .map_from_alias = nss_ad_map_from_alias,
 };
index 0aba36c30352a39ca08840ae2c1fa172aa65469f..743b0ec4ff8c254306890d8945b3d1b936ff488d 100644 (file)
@@ -282,46 +282,6 @@ static NTSTATUS nss_hash_init(struct nss_domain_entry *e )
        return NT_STATUS_OK;
 }
 
-/**********************************************************************
- *********************************************************************/
-
-static NTSTATUS nss_hash_get_info(struct nss_domain_entry *e,
-                                   const struct dom_sid *sid,
-                                   TALLOC_CTX *ctx,
-                                   const char **homedir,
-                                   const char **shell,
-                                   const char **gecos,
-                                   gid_t *p_gid )
-{
-       NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
-
-       nt_status = nss_hash_init(e);
-       BAIL_ON_NTSTATUS_ERROR(nt_status);
-
-       if (!homedir || !shell || !gecos) {
-               nt_status = NT_STATUS_INVALID_PARAMETER;
-               BAIL_ON_NTSTATUS_ERROR(nt_status);
-       }
-
-       *homedir = talloc_strdup(ctx, lp_template_homedir());
-       BAIL_ON_PTR_NT_ERROR(*homedir, nt_status);
-
-       *shell   = talloc_strdup(ctx, lp_template_shell());
-       BAIL_ON_PTR_NT_ERROR(*shell, nt_status);
-
-       *gecos   = NULL;
-
-       /* Initialize the gid so that the upper layer fills
-          in the proper Windows primary group */
-
-       if (*p_gid) {
-               *p_gid = (gid_t)-1;
-       }
-
-done:
-       return nt_status;
-}
-
 /**********************************************************************
  *********************************************************************/
 
@@ -374,7 +334,6 @@ static struct idmap_methods hash_idmap_methods = {
 
 static struct nss_info_methods hash_nss_methods = {
        .init           = nss_hash_init,
-       .get_nss_info   = nss_hash_get_info,
        .map_to_alias   = nss_hash_map_to_alias,
        .map_from_alias = nss_hash_map_from_alias,
        .close_fn       = nss_hash_close
index de93803064d0013c2f74998154d0c872dafbe797..53159b6c02e5517b6ca6f049fefe40535faf5172 100644 (file)
@@ -30,32 +30,6 @@ static NTSTATUS nss_template_init( struct nss_domain_entry *e )
        return NT_STATUS_OK;
 }
 
-/************************************************************************
- ***********************************************************************/
-
-static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
-                                      const struct dom_sid *sid,
-                                      TALLOC_CTX *ctx,
-                                      const char **homedir,
-                                      const char **shell,
-                                      const char **gecos,
-                                      gid_t *gid )
-{     
-       if ( !homedir || !shell || !gecos )
-               return NT_STATUS_INVALID_PARAMETER;
-
-       /* protect against home directories using whitespace in the
-         username */
-       *homedir = talloc_strdup( ctx, lp_template_homedir() );
-       *shell   = talloc_strdup( ctx, lp_template_shell() );
-
-       if ( !*homedir || !*shell ) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       return NT_STATUS_OK;
-}
-
 /**********************************************************************
  *********************************************************************/
 
@@ -92,7 +66,6 @@ static NTSTATUS nss_template_close( void )
 
 static struct nss_info_methods nss_template_methods = {
        .init           = nss_template_init,
-       .get_nss_info   = nss_template_get_info,
        .map_to_alias   = nss_template_map_to_alias,
        .map_from_alias = nss_template_map_from_alias,
        .close_fn       = nss_template_close