aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-30 11:49:06 -0500
committerTed Gould <ted@gould.cx>2012-08-30 11:49:06 -0500
commit5cabdb8b73427e5a95122d261f7d4243637d8e4d (patch)
treee62448f31d5f40474e51cf84bbd667557e4388c0
parent71d3d4aca6c9f2024f4ba84ba285705b4d74600d (diff)
downloadlibpam-x2go-5cabdb8b73427e5a95122d261f7d4243637d8e4d.tar.gz
libpam-x2go-5cabdb8b73427e5a95122d261f7d4243637d8e4d.tar.bz2
libpam-x2go-5cabdb8b73427e5a95122d261f7d4243637d8e4d.zip
Checking the return value of the mlock
-rw-r--r--src/pam-freerdp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index 89c5d5d..0e5c3fa 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -150,8 +150,13 @@ get_item (pam_handle_t * pamh, int type)
free(global_password);
}
global_password = strdup(promptval);
- mlock(global_password, strlen(global_password));
- retval = global_password;
+ if (mlock(global_password, strlen(global_password)) != 0) {
+ /* Woah, can't lock it. Can't keep it. */
+ free(global_password);
+ global_password = NULL;
+ } else {
+ retval = global_password;
+ }
}
free(promptval);