From 7180ae0b8e866d99de6827841970f16486eec7cd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 1 Aug 2009 10:38:13 -0400 Subject: Add some const to winbind_userinfo --- source3/include/nss_info.h | 9 +++++---- source3/winbindd/idmap_ad.c | 6 +++--- source3/winbindd/idmap_adex/idmap_adex.c | 5 +++-- source3/winbindd/idmap_adex/idmap_adex.h | 5 +++-- source3/winbindd/idmap_adex/provider_unified.c | 22 +++++++++++++--------- source3/winbindd/idmap_hash/idmap_hash.c | 6 +++--- source3/winbindd/nss_info.c | 6 +++--- source3/winbindd/nss_info_template.c | 6 +++--- source3/winbindd/winbindd.h | 10 +++++----- source3/winbindd/winbindd_ads.c | 7 ++++--- source3/winbindd/winbindd_cache.c | 4 ++-- source3/winbindd/winbindd_proto.h | 4 ++-- 12 files changed, 49 insertions(+), 41 deletions(-) diff --git a/source3/include/nss_info.h b/source3/include/nss_info.h index 0224be099f..90d992a3b9 100644 --- a/source3/include/nss_info.h +++ b/source3/include/nss_info.h @@ -65,7 +65,8 @@ struct nss_info_methods { 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); @@ -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, - TALLOC_CTX *ctx, + 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 nss_map_to_alias( TALLOC_CTX *mem_ctx, const char *domain, const char *name, char **alias ); diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c index 3791a86876..4e1ca346c0 100644 --- a/source3/winbindd/idmap_ad.c +++ b/source3/winbindd/idmap_ad.c @@ -822,9 +822,9 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e, 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 */ diff --git a/source3/winbindd/idmap_adex/idmap_adex.c b/source3/winbindd/idmap_adex/idmap_adex.c index e2fcda83d3..5ca7df0b4a 100644 --- a/source3/winbindd/idmap_adex/idmap_adex.c +++ b/source3/winbindd/idmap_adex/idmap_adex.c @@ -318,8 +318,9 @@ static NTSTATUS _nss_adex_get_info(struct 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; diff --git a/source3/winbindd/idmap_adex/idmap_adex.h b/source3/winbindd/idmap_adex/idmap_adex.h index e068d5c340..6d6881e01d 100644 --- a/source3/winbindd/idmap_adex/idmap_adex.h +++ b/source3/winbindd/idmap_adex/idmap_adex.h @@ -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, - 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); diff --git a/source3/winbindd/idmap_adex/provider_unified.c b/source3/winbindd/idmap_adex/provider_unified.c index 00db018de2..d48989f45f 100644 --- a/source3/winbindd/idmap_adex/provider_unified.c +++ b/source3/winbindd/idmap_adex/provider_unified.c @@ -895,21 +895,25 @@ done: 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; + 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); + *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); + *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 = tmp; 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, - 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; diff --git a/source3/winbindd/idmap_hash/idmap_hash.c b/source3/winbindd/idmap_hash/idmap_hash.c index 42830720f3..7d4dd2b5ab 100644 --- a/source3/winbindd/idmap_hash/idmap_hash.c +++ b/source3/winbindd/idmap_hash/idmap_hash.c @@ -276,9 +276,9 @@ static NTSTATUS nss_hash_get_info(struct nss_domain_entry *e, 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; diff --git a/source3/winbindd/nss_info.c b/source3/winbindd/nss_info.c index 734c009602..382aa86df0 100644 --- a/source3/winbindd/nss_info.c +++ b/source3/winbindd/nss_info.c @@ -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, - 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; diff --git a/source3/winbindd/nss_info_template.c b/source3/winbindd/nss_info_template.c index f44c73f3a6..12d9c51896 100644 --- a/source3/winbindd/nss_info_template.c +++ b/source3/winbindd/nss_info_template.c @@ -37,9 +37,9 @@ static NTSTATUS nss_template_get_info( struct nss_domain_entry *e, 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 ) diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h index 64fb8851df..8f0db44617 100644 --- a/source3/winbindd/winbindd.h +++ b/source3/winbindd/winbindd.h @@ -91,11 +91,11 @@ struct getpwent_user { /* 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 */ diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c index 50985ccdda..a95b31da48 100644 --- a/source3/winbindd/winbindd_ads.c +++ b/source3/winbindd/winbindd_ads.c @@ -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)) { - 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; diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index b8872a18d4..bec2a714c8 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -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, - 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; diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 03e254cbb9..c9decf8cc4 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -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, - 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 */ -- cgit