Handle failure of getpwuid().

Signed-off-by: Alon Bar-Lev <[EMAIL PROTECTED]>

---

diff -urNp ecryptfs-utils-23/src/key_mod/ecryptfs_key_mod_openssl.c 
ecryptfs-utils-24_beta1/src/key_mod/ecryptfs_key_mod_openssl.c
--- ecryptfs-utils-23/src/key_mod/ecryptfs_key_mod_openssl.c    2007-08-20 
14:54:16.000000000 +0300
+++ ecryptfs-utils-24_beta1/src/key_mod/ecryptfs_key_mod_openssl.c      
2007-10-03 12:01:40.000000000 +0200
@@ -941,6 +941,10 @@ static int ecryptfs_openssl_init(char **
        }
        id = getuid();
        pw = getpwuid(id);
+       if (!pw) {
+               rc = -EIO;
+               goto out;
+       }
        if ((rc = asprintf(&ssl_param_nodes[SSL_FILE_TOK].suggested_val,
                           "%s/.ecryptfs/pki/openssl/key.pem",
                           pw->pw_dir)) == -1) {
diff -urNp ecryptfs-utils-23/src/libecryptfs/cmd_ln_parser.c 
ecryptfs-utils-24_beta1/src/libecryptfs/cmd_ln_parser.c
--- ecryptfs-utils-23/src/libecryptfs/cmd_ln_parser.c   2007-08-20 
14:54:16.000000000 +0300
+++ ecryptfs-utils-24_beta1/src/libecryptfs/cmd_ln_parser.c     2007-10-03 
11:07:25.000000000 +0200
@@ -217,6 +217,10 @@ int ecryptfs_parse_rc_file(struct ecrypt
 
        uid = getuid();
        pw = getpwuid(uid);
+       if (!pw) {
+               rc = -EIO;
+               goto out;
+       }
        home = pw->pw_dir;
        rc = asprintf(&rcfile_fullpath, "%s/.ecryptfsrc", home);
        if (rc == -1) {
diff -urNp ecryptfs-utils-23/src/utils/mount.ecryptfs.c 
ecryptfs-utils-24_beta1/src/utils/mount.ecryptfs.c
--- ecryptfs-utils-23/src/utils/mount.ecryptfs.c        2007-08-20 
14:54:16.000000000 +0300
+++ ecryptfs-utils-24_beta1/src/utils/mount.ecryptfs.c  2007-10-03 
12:58:12.000000000 +0200
@@ -298,6 +298,10 @@ static int process_sig(char *auth_tok_si
 
        id = getuid();
        pw = getpwuid(id);
+       if (!pw) {
+               rc = -EIO;
+               goto out;
+       }
        home = pw->pw_dir;
        rc = asprintf(&dot_ecryptfs_dir, "%s/.ecryptfs", home);
        if (rc == -1) {

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
eCryptfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecryptfs-devel

Reply via email to