diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/confdb/confdb.c | 4 | ||||
-rw-r--r-- | server/db/sysdb.c | 5 | ||||
-rw-r--r-- | server/providers/dp_auth_util.c | 8 | ||||
-rw-r--r-- | server/providers/ldap/ldap_auth.c | 5 | ||||
-rw-r--r-- | server/providers/proxy.c | 9 | ||||
-rw-r--r-- | server/responder/common/responder.h | 4 | ||||
-rw-r--r-- | server/responder/nss/nsssrv_cmd.c | 4 | ||||
-rw-r--r-- | server/responder/nss/nsssrv_nc.c | 8 | ||||
-rw-r--r-- | server/tools/tools_util.c | 2 | ||||
-rw-r--r-- | server/util/nss_sha512crypt.c | 2 |
10 files changed, 29 insertions, 22 deletions
diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c index 0bafc493..0c30d472 100644 --- a/server/confdb/confdb.c +++ b/server/confdb/confdb.c @@ -64,7 +64,7 @@ int parse_section(TALLOC_CTX *mem_ctx, const char *section, char **sec_dn, const char **rdn_name) { TALLOC_CTX *tmp_ctx; - char *dn; + char *dn = NULL; char *p; const char *s; int l, ret; @@ -776,7 +776,7 @@ int confdb_get_domains(struct confdb_ctx *cdb, struct sss_domain_info **domains) { TALLOC_CTX *tmp_ctx; - struct sss_domain_info *domain, *prevdom; + struct sss_domain_info *domain, *prevdom = NULL; struct sss_domain_info *first = NULL; char **domlist; int ret, i; diff --git a/server/db/sysdb.c b/server/db/sysdb.c index 1268d939..7a473186 100644 --- a/server/db/sysdb.c +++ b/server/db/sysdb.c @@ -88,13 +88,12 @@ static int sysdb_attrs_get_el(struct sysdb_attrs *attrs, const char *name, int sysdb_attrs_add_val(struct sysdb_attrs *attrs, const char *name, const struct ldb_val *val) { - struct ldb_message_element *el; + struct ldb_message_element *el = NULL; struct ldb_val *vals; int ret; ret = sysdb_attrs_get_el(attrs, name, &el); - vals = talloc_realloc(attrs->a, el->values, struct ldb_val, el->num_values+1); if (!vals) return ENOMEM; @@ -116,7 +115,7 @@ int sysdb_attrs_add_string(struct sysdb_attrs *attrs, { struct ldb_val v; - v.data = (uint8_t *)str; + v.data = (uint8_t *)discard_const(str); v.length = strlen(str); return sysdb_attrs_add_val(attrs, name, &v); diff --git a/server/providers/dp_auth_util.c b/server/providers/dp_auth_util.c index 366a3fb2..279e50b6 100644 --- a/server/providers/dp_auth_util.c +++ b/server/providers/dp_auth_util.c @@ -60,10 +60,10 @@ bool dp_pack_pam_request(DBusMessage *msg, struct pam_data *pd) int ret; if (pd->user == NULL || pd->domain == NULL) return false; - if (pd->service == NULL) pd->service = ""; - if (pd->tty == NULL) pd->tty = ""; - if (pd->ruser == NULL) pd->ruser = ""; - if (pd->rhost == NULL) pd->rhost = ""; + if (pd->service == NULL) pd->service = talloc_strdup(pd, ""); + if (pd->tty == NULL) pd->tty = talloc_strdup(pd, ""); + if (pd->ruser == NULL) pd->ruser = talloc_strdup(pd, ""); + if (pd->rhost == NULL) pd->rhost = talloc_strdup(pd, ""); ret = dbus_message_append_args(msg, diff --git a/server/providers/ldap/ldap_auth.c b/server/providers/ldap/ldap_auth.c index 7d48ba07..b2100895 100644 --- a/server/providers/ldap/ldap_auth.c +++ b/server/providers/ldap/ldap_auth.c @@ -299,7 +299,7 @@ static void sdap_pam_loop(struct tevent_context *ev, struct tevent_fd *te, char *errmsgp = NULL; /* FIXME: user timeout form config */ char *filter=NULL; - char *attrs[] = { LDAP_NO_ATTRS, NULL }; + char *attrs[2] = { NULL, NULL }; lr = talloc_get_type(pvt, struct sdap_req); @@ -394,6 +394,7 @@ static void sdap_pam_loop(struct tevent_context *ev, struct tevent_fd *te, lr->sdap_ctx->user_name_attribute, lr->pd->user, lr->sdap_ctx->user_object_class); + attrs[0] = talloc_strdup(lr->sdap_ctx, LDAP_NO_ATTRS); DEBUG(4, ("calling ldap_search_ext with [%s].\n", filter)); ret = ldap_search_ext(lr->ldap, @@ -695,7 +696,7 @@ static void sdap_cache_pw_op(struct sysdb_req *req, void *pvt) struct sdap_pw_cache *data = talloc_get_type(pvt, struct sdap_pw_cache); struct pam_data *pd; const char *username; - const char *password; + char *password; int ret; data->sysreq = req; diff --git a/server/providers/proxy.c b/server/providers/proxy.c index c6ab4e34..4acec90a 100644 --- a/server/providers/proxy.c +++ b/server/providers/proxy.c @@ -72,7 +72,7 @@ struct authtok_conv { }; static void cache_password(struct be_req *req, - char *username, + const char *username, struct authtok_conv *ac); static void proxy_reply(struct be_req *req, int error, const char *errstr); @@ -288,7 +288,6 @@ static void proxy_reply(struct be_req *req, int error, const char *errstr) static void cache_pw_return(void *pvt, int error, struct ldb_result *ignore) { struct proxy_data *data = talloc_get_type(pvt, struct proxy_data); - const char *err = "Success"; if (error != EOK) { DEBUG(2, ("Failed to cache password (%d)[%s]!?\n", @@ -331,7 +330,7 @@ static int password_destructor(void *memctx) } static void cache_password(struct be_req *req, - char *username, + const char *username, struct authtok_conv *ac) { struct proxy_data *data; @@ -348,7 +347,9 @@ static void cache_password(struct be_req *req, data->pwd = talloc(data, struct passwd); if (!data->pwd) return proxy_reply(req, ENOMEM, "Out of memory"); - data->pwd->pw_name = username; + data->pwd->pw_name = talloc_strdup(data, username); + if (!data->pwd->pw_name) + return proxy_reply(req, ENOMEM, "Out of memory"); data->pwd->pw_passwd = talloc_size(data, ac->authtok_size + 1); if (!data->pwd->pw_passwd) return proxy_reply(req, ENOMEM, "Out of memory"); diff --git a/server/responder/common/responder.h b/server/responder/common/responder.h index 13ebf073..f3d3293d 100644 --- a/server/responder/common/responder.h +++ b/server/responder/common/responder.h @@ -49,8 +49,8 @@ struct cli_request { struct cli_protocol_version { uint32_t version; - char *date; - char *description; + const char *date; + const char *description; }; struct sss_names_ctx { diff --git a/server/responder/nss/nsssrv_cmd.c b/server/responder/nss/nsssrv_cmd.c index 2eb1dce0..5a779018 100644 --- a/server/responder/nss/nsssrv_cmd.c +++ b/server/responder/nss/nsssrv_cmd.c @@ -834,6 +834,7 @@ static int nss_cmd_getpwuid(struct cli_ctx *cctx) int ret; int ncret; + ret = ENOENT; nctx = talloc_get_type(cctx->rctx->pvt_ctx, struct nss_ctx); cmdctx = talloc_zero(cctx, struct nss_cmd_ctx); @@ -1342,7 +1343,9 @@ static int fill_grent(struct sss_packet *packet, num = 0; mnump = 0; + memnum = 0; get_members = false; + skip_members = false; for (i = 0; i < count; i++) { msg = msgs[i]; @@ -2186,6 +2189,7 @@ static int nss_cmd_getgrgid(struct cli_ctx *cctx) int ret; int ncret; + ret = ENOENT; nctx = talloc_get_type(cctx->rctx->pvt_ctx, struct nss_ctx); cmdctx = talloc_zero(cctx, struct nss_cmd_ctx); diff --git a/server/responder/nss/nsssrv_nc.c b/server/responder/nss/nsssrv_nc.c index d6a808dc..1fa7d612 100644 --- a/server/responder/nss/nsssrv_nc.c +++ b/server/responder/nss/nsssrv_nc.c @@ -279,7 +279,7 @@ static int delete_permanent(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *state) { unsigned long long int timestamp; - bool remove = false; + bool remove_key = false; char *ep; if (strncmp((char *)key.dptr, @@ -292,17 +292,17 @@ static int delete_permanent(struct tdb_context *tdb, timestamp = strtoull((const char *)data.dptr, &ep, 0); if (errno != 0 || *ep != '\0') { /* Malformed entry, remove it */ - remove = true; + remove_key = true; goto done; } if (timestamp == 0) { /* a 0 timestamp means this is a permanent entry */ - remove = true; + remove_key = true; } done: - if (remove) { + if (remove_key) { return tdb_delete(tdb, key); } diff --git a/server/tools/tools_util.c b/server/tools/tools_util.c index 72ab1664..0f093cb8 100644 --- a/server/tools/tools_util.c +++ b/server/tools/tools_util.c @@ -209,7 +209,7 @@ int parse_groups(TALLOC_CTX *mem_ctx, const char *optstr, char ***_out) return ENOMEM; } - n = orig; + n = o = orig; for (i = 0; i < tokens; i++) { o = n; n = strchr(n, delim); diff --git a/server/util/nss_sha512crypt.c b/server/util/nss_sha512crypt.c index f02dbef3..47f676d5 100644 --- a/server/util/nss_sha512crypt.c +++ b/server/util/nss_sha512crypt.c @@ -42,6 +42,7 @@ static int nspr_nss_init(void) } /* added for completness, so far not used */ +#if 0 static int nspr_nss_cleanup(void) { int ret; @@ -53,6 +54,7 @@ static int nspr_nss_cleanup(void) nspr_nss_init_done = 0; return 0; } +#endif /* Define our magic string to mark salt for SHA512 "encryption" replacement. */ const char sha512_salt_prefix[] = "$6$"; |