|
1 --- src/tspi/ps/tspps.c.orig 2011-03-24 13:06:14.607907754 -0700 |
|
2 +++ src/tspi/ps/tspps.c 2011-03-24 13:07:30.668528209 -0700 |
|
3 @@ -70,9 +70,12 @@ |
|
4 TSS_RESULT result; |
|
5 char *file_name = NULL, *home_dir = NULL; |
|
6 struct passwd *pwp; |
|
7 -#if (defined (__linux) || defined (linux) || defined(__GLIBC__)) |
|
8 +#if (defined (__linux) || defined (linux) || defined(__GLIBC__) || defined(SOLARIS)) |
|
9 struct passwd pw; |
|
10 #endif |
|
11 +#ifdef SOLARIS |
|
12 + char pwbuf[PASSWD_BUFSIZE]; |
|
13 +#endif |
|
14 struct stat stat_buf; |
|
15 char buf[PASSWD_BUFSIZE]; |
|
16 uid_t euid; |
|
17 @@ -94,9 +97,16 @@ |
|
18 * in the user's home directory, which may be shared |
|
19 * by multiple systems. |
|
20 * |
|
21 - * The directory path on Solaris is /var/tpm/userps/[EUID]/ |
|
22 + * The directory path on Solaris is /var/user[USERNAME]/tpm/userps |
|
23 */ |
|
24 - rc = snprintf(buf, sizeof (buf), "%s/%d", TSS_USER_PS_DIR, euid); |
|
25 + |
|
26 + pwp = getpwuid_r(euid, &pw, pwbuf, sizeof (pwbuf)); |
|
27 + if (pwp != NULL) { |
|
28 + rc = snprintf(buf, sizeof (buf), "/var/user/%s/tpm/userps", |
|
29 + pwp->pw_name); |
|
30 + } else { |
|
31 + return TSPERR(TSS_E_INTERNAL_ERROR); |
|
32 + } |
|
33 #else |
|
34 setpwent(); |
|
35 while (1) { |
|
36 @@ -142,7 +152,7 @@ |
|
37 if (errno == ENOENT) { |
|
38 errno = 0; |
|
39 /* Create the user's ps directory if it is not there. */ |
|
40 - if ((rc = mkdir(buf, 0700)) == -1) { |
|
41 + if ((rc = mkdirp(buf, 0700)) == -1) { |
|
42 LogDebugFn("USER PS: Error creating dir: %s: %s", buf, |
|
43 strerror(errno)); |
|
44 result = TSPERR(TSS_E_INTERNAL_ERROR); |
|
45 @@ -157,8 +167,8 @@ |
|
46 |
|
47 /* Directory exists or has been created, return the path to the file */ |
|
48 #if defined (SOLARIS) |
|
49 - rc = snprintf(buf, sizeof (buf), "%s/%d/%s", TSS_USER_PS_DIR, euid, |
|
50 - TSS_USER_PS_FILE); |
|
51 + rc = snprintf(buf, sizeof (buf), "/var/user/%s/tpm/userps/%s", |
|
52 + pwp->pw_name, TSS_USER_PS_FILE); |
|
53 #else |
|
54 rc = snprintf(buf, sizeof (buf), "%s/%s/%s", home_dir, TSS_USER_PS_DIR, |
|
55 TSS_USER_PS_FILE); |