summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2009-05-14 12:38:03 +0200
committerSimo Sorce <ssorce@redhat.com>2009-05-14 11:29:02 -0400
commit5422d203f05859fa2841e3a68980813806eb9581 (patch)
treed33d35a0cfe135e330c360ea4069022620a1981b
parentfbd46659003e418c2cd3551b425fcd24a1befd13 (diff)
downloadsssd-5422d203f05859fa2841e3a68980813806eb9581.tar.gz
sssd-5422d203f05859fa2841e3a68980813806eb9581.tar.xz
sssd-5422d203f05859fa2841e3a68980813806eb9581.zip
added check for NULL values
- allow unspecified value in struct pam_data to be NULL - check if domain structure is initialized in pam_reply
-rw-r--r--server/providers/dp_auth_util.c7
-rw-r--r--server/responder/pam/pamsrv_cmd.c1
-rw-r--r--server/responder/pam/pamsrv_dp.c9
3 files changed, 8 insertions, 9 deletions
diff --git a/server/providers/dp_auth_util.c b/server/providers/dp_auth_util.c
index 630dafe8c..366a3fb2d 100644
--- a/server/providers/dp_auth_util.c
+++ b/server/providers/dp_auth_util.c
@@ -59,6 +59,13 @@ 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 = "";
+
+
ret = dbus_message_append_args(msg,
DBUS_TYPE_INT32, &(pd->cmd),
DBUS_TYPE_STRING, &(pd->domain),
diff --git a/server/responder/pam/pamsrv_cmd.c b/server/responder/pam/pamsrv_cmd.c
index 6d3f89918..df0cba454 100644
--- a/server/responder/pam/pamsrv_cmd.c
+++ b/server/responder/pam/pamsrv_cmd.c
@@ -141,6 +141,7 @@ static void pam_reply(struct pam_auth_req *preq)
DEBUG(4, ("pam_reply get called.\n"));
if ((pd->cmd == SSS_PAM_AUTHENTICATE) &&
+ (preq->domain != NULL) &&
(preq->domain->cache_credentials == true) &&
(pd->offline_auth == false)) {
diff --git a/server/responder/pam/pamsrv_dp.c b/server/responder/pam/pamsrv_dp.c
index f352b270f..fadb284a8 100644
--- a/server/responder/pam/pamsrv_dp.c
+++ b/server/responder/pam/pamsrv_dp.c
@@ -88,15 +88,6 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
DBusConnection *conn;
dbus_bool_t ret;
- if ((pd->domain == NULL) ||
- (pd->user == NULL) ||
- (pd->service == NULL) ||
- (pd->tty == NULL) ||
- (pd->ruser == NULL) ||
- (pd->rhost == NULL) ) {
- return EINVAL;
- }
-
/* double check dp_ctx has actually been initialized.
* in some pathological cases it may happen that nss starts up before
* dp connection code is actually able to establish a connection.