From 5eadfd50562c19f3e71ee754cd58173a25420996 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 26 May 2009 10:19:00 -0400 Subject: Silence warnings --- server/providers/dp_auth_util.c | 8 ++++---- server/providers/ldap/ldap_auth.c | 5 +++-- server/providers/proxy.c | 9 +++++---- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'server/providers') 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"); -- cgit