Add some const to winbind_userinfo
authorVolker Lendecke <vl@samba.org>
Sat, 1 Aug 2009 14:38:13 +0000 (10:38 -0400)
committerVolker Lendecke <vl@samba.org>
Mon, 3 Aug 2009 20:48:45 +0000 (22:48 +0200)
12 files changed:
source3/include/nss_info.h
source3/winbindd/idmap_ad.c
source3/winbindd/idmap_adex/idmap_adex.c
source3/winbindd/idmap_adex/idmap_adex.h
source3/winbindd/idmap_adex/provider_unified.c
source3/winbindd/idmap_hash/idmap_hash.c
source3/winbindd/nss_info.c
source3/winbindd/nss_info_template.c
source3/winbindd/winbindd.h
source3/winbindd/winbindd_ads.c
source3/winbindd/winbindd_cache.c
source3/winbindd/winbindd_proto.h

index 0224be099fa1cd5e40e46b8552cb760a64df4de7..90d992a3b948a7421a77602b8e638dcbfa967828 100644 (file)
@@ -65,7 +65,8 @@ struct nss_info_methods {
                                  const DOM_SID *sid, 
                                  TALLOC_CTX *ctx, 
                                  ADS_STRUCT *ads, LDAPMessage *msg,
                                  const DOM_SID *sid, 
                                  TALLOC_CTX *ctx, 
                                  ADS_STRUCT *ads, LDAPMessage *msg,
-                                 char **homedir, char **shell, char **gecos, gid_t *p_gid);
+                                 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);
        NTSTATUS (*map_to_alias)(TALLOC_CTX *mem_ctx,
                                 struct nss_domain_entry *e,
                                 const char *name, char **alias);
@@ -85,10 +86,10 @@ NTSTATUS smb_register_idmap_nss(int version,
 NTSTATUS nss_init( const char **nss_list );
 
 NTSTATUS nss_get_info( const char *domain, const DOM_SID *user_sid,
 NTSTATUS nss_init( const char **nss_list );
 
 NTSTATUS nss_get_info( const char *domain, const DOM_SID *user_sid,
-                       TALLOC_CTX *ctx,
+                      TALLOC_CTX *ctx,
                       ADS_STRUCT *ads, LDAPMessage *msg,
                       ADS_STRUCT *ads, LDAPMessage *msg,
-                       char **homedir, char **shell, char **gecos,
-                       gid_t *p_gid);
+                      const char **homedir, const char **shell,
+                      const char **gecos, gid_t *p_gid);
 
 NTSTATUS nss_map_to_alias( TALLOC_CTX *mem_ctx, const char *domain,
                           const char *name, char **alias );
 
 NTSTATUS nss_map_to_alias( TALLOC_CTX *mem_ctx, const char *domain,
                           const char *name, char **alias );
index 3791a86876f9da33ca316ef74f59e7cc7444ded5..4e1ca346c0010463608e65ccd260e799ec4fe139 100644 (file)
@@ -822,9 +822,9 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e,
                                  TALLOC_CTX *mem_ctx,
                                  ADS_STRUCT *ads, 
                                  LDAPMessage *msg,
                                  TALLOC_CTX *mem_ctx,
                                  ADS_STRUCT *ads, 
                                  LDAPMessage *msg,
-                                 char **homedir,
-                                 char **shell, 
-                                 char **gecos,
+                                 const char **homedir,
+                                 const char **shell,
+                                 const char **gecos,
                                  uint32 *gid )
 {
        const char *attrs[] = {NULL, /* attr_homedir */
                                  uint32 *gid )
 {
        const char *attrs[] = {NULL, /* attr_homedir */
index e2fcda83d329571a9708e2ca162a1bc2adf6d350..5ca7df0b4a9498dbd75c038d9bccd9d2ac95b031 100644 (file)
@@ -318,8 +318,9 @@ static NTSTATUS _nss_adex_get_info(struct
                                      TALLOC_CTX * ctx,
                                      ADS_STRUCT * ads,
                                      LDAPMessage * msg,
                                      TALLOC_CTX * ctx,
                                      ADS_STRUCT * ads,
                                      LDAPMessage * msg,
-                                     char **homedir,
-                                     char **shell, char **gecos, gid_t * p_gid)
+                                     const char **homedir,
+                                     const char **shell,
+                                     const char **gecos, gid_t * p_gid)
 {
        NTSTATUS nt_status;
         struct likewise_cell *cell;
 {
        NTSTATUS nt_status;
         struct likewise_cell *cell;
index e068d5c3403b972a14f1df05922eca9181605db4..6d6881e01d6a2c9c2b8e2d45776e9656959fa90f 100644 (file)
@@ -97,8 +97,9 @@ struct cell_provider_api {
                                    enum id_type * type, const DOM_SID * sid);
        NTSTATUS(*get_nss_info) (const DOM_SID * sid,
                                 TALLOC_CTX * ctx,
                                    enum id_type * type, const DOM_SID * sid);
        NTSTATUS(*get_nss_info) (const DOM_SID * sid,
                                 TALLOC_CTX * ctx,
-                                char **homedir,
-                                char **shell, char **gecos, gid_t * p_gid);
+                                const char **homedir,
+                                const char **shell,
+                                const char **gecos, gid_t * p_gid);
        NTSTATUS(*map_to_alias) (TALLOC_CTX * mem_ctx,
                                 const char *domain,
                                 const char *name, char **alias);
        NTSTATUS(*map_to_alias) (TALLOC_CTX * mem_ctx,
                                 const char *domain,
                                 const char *name, char **alias);
index 00db018de2d72f78cffc3cf1c6e2dc5882cf95ac..d48989f45fce9f5064372be873472d7c689c3249 100644 (file)
@@ -895,21 +895,25 @@ done:
 static NTSTATUS pull_nss_info(struct likewise_cell *c,
                              LDAPMessage *msg,
                              TALLOC_CTX *ctx,
 static NTSTATUS pull_nss_info(struct likewise_cell *c,
                              LDAPMessage *msg,
                              TALLOC_CTX *ctx,
-                             char **homedir,
-                             char **shell,
-                             char **gecos,
+                             const char **homedir,
+                             const char **shell,
+                             const char **gecos,
                              gid_t *p_gid)
 {
        NTSTATUS nt_status;
                              gid_t *p_gid)
 {
        NTSTATUS nt_status;
+       char *tmp;
 
 
-       nt_status = get_object_string(c, msg, ctx, ADEX_ATTR_HOMEDIR, homedir);
+       nt_status = get_object_string(c, msg, ctx, ADEX_ATTR_HOMEDIR, &tmp);
        BAIL_ON_NTSTATUS_ERROR(nt_status);
        BAIL_ON_NTSTATUS_ERROR(nt_status);
+       *homedir = tmp;
 
 
-       nt_status = get_object_string(c, msg, ctx, ADEX_ATTR_SHELL, shell);
+       nt_status = get_object_string(c, msg, ctx, ADEX_ATTR_SHELL, &tmp);
        BAIL_ON_NTSTATUS_ERROR(nt_status);
        BAIL_ON_NTSTATUS_ERROR(nt_status);
+       *shell = tmp;
 
 
-       nt_status = get_object_string(c, msg, ctx, ADEX_ATTR_GECOS, gecos);
+       nt_status = get_object_string(c, msg, ctx, ADEX_ATTR_GECOS, &tmp);
        /* Gecos is often not set so ignore failures */
        /* Gecos is often not set so ignore failures */
+       *gecos = tmp;
 
        nt_status = get_object_uint32(c, msg, ADEX_ATTR_GIDNUM, p_gid);
        BAIL_ON_NTSTATUS_ERROR(nt_status);
 
        nt_status = get_object_uint32(c, msg, ADEX_ATTR_GIDNUM, p_gid);
        BAIL_ON_NTSTATUS_ERROR(nt_status);
@@ -1021,9 +1025,9 @@ done:
 
 static NTSTATUS _ccp_nss_get_info(const DOM_SID * sid,
                                  TALLOC_CTX * ctx,
 
 static NTSTATUS _ccp_nss_get_info(const DOM_SID * sid,
                                  TALLOC_CTX * ctx,
-                                 char **homedir,
-                                 char **shell,
-                                 char **gecos, gid_t * p_gid)
+                                 const char **homedir,
+                                 const char **shell,
+                                 const char **gecos, gid_t * p_gid)
 {
        struct likewise_cell *cell = NULL;
        LDAPMessage *msg = NULL;
 {
        struct likewise_cell *cell = NULL;
        LDAPMessage *msg = NULL;
index 42830720f3c5ba32892a5806975f6da560040f86..7d4dd2b5ab01578ff758cd6374a83d3aae364f36 100644 (file)
@@ -276,9 +276,9 @@ static NTSTATUS nss_hash_get_info(struct nss_domain_entry *e,
                                    TALLOC_CTX *ctx,
                                    ADS_STRUCT *ads,
                                    LDAPMessage *msg,
                                    TALLOC_CTX *ctx,
                                    ADS_STRUCT *ads,
                                    LDAPMessage *msg,
-                                   char **homedir,
-                                   char **shell,
-                                   char **gecos,
+                                   const char **homedir,
+                                   const char **shell,
+                                   const char **gecos,
                                    gid_t *p_gid )
 {
        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
                                    gid_t *p_gid )
 {
        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
index 734c0096024b663cc6e4ee3817564c09d5d222fb..382aa86df0d9f6ada034031cca01d08c2ececfa6 100644 (file)
@@ -299,11 +299,11 @@ static struct nss_domain_entry *find_nss_domain( const char *domain )
 /********************************************************************
  *******************************************************************/
 
 /********************************************************************
  *******************************************************************/
 
- NTSTATUS nss_get_info( const char *domain, const DOM_SID *user_sid,
+NTSTATUS nss_get_info( const char *domain, const DOM_SID *user_sid,
                       TALLOC_CTX *ctx,
                       ADS_STRUCT *ads, LDAPMessage *msg,
                       TALLOC_CTX *ctx,
                       ADS_STRUCT *ads, LDAPMessage *msg,
-                      char **homedir, char **shell, char **gecos,
-                      gid_t *p_gid)
+                      const char **homedir, const char **shell,
+                      const char **gecos, gid_t *p_gid)
 {
        struct nss_domain_entry *p;
        struct nss_info_methods *m;
 {
        struct nss_domain_entry *p;
        struct nss_info_methods *m;
index f44c73f3a60c6128a63cc912258e886a7bf2e0e5..12d9c518962645d313383b00323edde149edc53b 100644 (file)
@@ -37,9 +37,9 @@ static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
                                       TALLOC_CTX *ctx,
                                       ADS_STRUCT *ads,
                                       LDAPMessage *msg,
                                       TALLOC_CTX *ctx,
                                       ADS_STRUCT *ads,
                                       LDAPMessage *msg,
-                                      char **homedir,
-                                      char **shell, 
-                                      char **gecos,
+                                      const char **homedir,
+                                      const char **shell,
+                                      const char **gecos,
                                       gid_t *gid )
 {     
        if ( !homedir || !shell || !gecos )
                                       gid_t *gid )
 {     
        if ( !homedir || !shell || !gecos )
index 64fb8851df77de96c6f8250ca67570fe8c2004a8..8f0db44617090bdf2c627250406e5377d552d630 100644 (file)
@@ -91,11 +91,11 @@ struct getpwent_user {
 
 /* Server state structure */
 
 
 /* Server state structure */
 
-typedef struct {
-       char *acct_name;
-       char *full_name;
-       char *homedir;
-       char *shell;
+typedef struct winbind_userinfo {
+       const char *acct_name;
+       const char *full_name;
+       const char *homedir;
+       const char *shell;
        gid_t primary_gid;                   /* allow the nss_info
                                                backend to set the primary group */
        DOM_SID user_sid;                    /* NT user and primary group SIDs */
        gid_t primary_gid;                   /* allow the nss_info
                                                backend to set the primary group */
        DOM_SID user_sid;                    /* NT user and primary group SIDs */
index 50985ccdda65f49533353a0b63f293c2d206c61d..a95b31da48a9790a4cea52b2009f8068a3ca0f9a 100644 (file)
@@ -201,9 +201,10 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
        i = 0;
 
        for (msg = ads_first_entry(ads, res); msg; msg = ads_next_entry(ads, msg)) {
        i = 0;
 
        for (msg = ads_first_entry(ads, res); msg; msg = ads_next_entry(ads, msg)) {
-               char *name, *gecos = NULL;
-               char *homedir = NULL;
-               char *shell = NULL;
+               const char *name;
+               const char *gecos = NULL;
+               const char *homedir = NULL;
+               const char *shell = NULL;
                uint32 group;
                uint32 atype;
                DOM_SID user_sid;
                uint32 group;
                uint32 atype;
                DOM_SID user_sid;
index b8872a18d4bf6d7f0f0d196be96dbb7bf53d2bf6..bec2a714c80a8c18c318025fcb8ea927e4f344d3 100644 (file)
@@ -4090,8 +4090,8 @@ NTSTATUS nss_get_info_cached( struct winbindd_domain *domain,
                              const DOM_SID *user_sid,
                              TALLOC_CTX *ctx,
                              ADS_STRUCT *ads, LDAPMessage *msg,
                              const DOM_SID *user_sid,
                              TALLOC_CTX *ctx,
                              ADS_STRUCT *ads, LDAPMessage *msg,
-                             char **homedir, char **shell, char **gecos,
-                             gid_t *p_gid)
+                             const char **homedir, const char **shell,
+                             const char **gecos, gid_t *p_gid)
 {
        struct winbind_cache *cache = get_cache(domain);
        struct cache_entry *centry = NULL;
 {
        struct winbind_cache *cache = get_cache(domain);
        struct cache_entry *centry = NULL;
index 03e254cbb96a2ee2ca71b45c3de51caa1b5d905d..c9decf8cc4a2137152aa9b79bd5a8b079e426c2d 100644 (file)
@@ -177,8 +177,8 @@ NTSTATUS nss_get_info_cached( struct winbindd_domain *domain,
                              const DOM_SID *user_sid,
                              TALLOC_CTX *ctx,
                              ADS_STRUCT *ads, LDAPMessage *msg,
                              const DOM_SID *user_sid,
                              TALLOC_CTX *ctx,
                              ADS_STRUCT *ads, LDAPMessage *msg,
-                             char **homedir, char **shell, char **gecos,
-                             gid_t *p_gid);
+                             const char **homedir, const char **shell,
+                             const char **gecos, gid_t *p_gid);
 
 /* The following definitions come from winbindd/winbindd_ccache_access.c  */
 
 
 /* The following definitions come from winbindd/winbindd_ccache_access.c  */