Changeset 131 for trunk/src/sh_gpg.c
- Timestamp:
- Oct 22, 2007, 11:19:15 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_gpg.c
r111 r131 292 292 struct stat lbuf; 293 293 int status_stat = 0; 294 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 295 struct passwd pwd; 296 char buffer[SH_PWBUF_SIZE]; 297 struct passwd * tempres; 298 sh_getpwnam_r(DEFAULT_IDENT, &pwd, buffer, sizeof(buffer), &tempres); 299 #else 294 300 struct passwd * tempres = sh_getpwnam(DEFAULT_IDENT); 301 #endif 295 302 296 303 if (!tempres) … … 844 851 while (NULL != fgets(line, sizeof(line), source.pipe)) 845 852 { 853 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_STRTOK_R) 854 char * saveptr = NULL; 855 #endif 846 856 if (line[strlen(line)-1] == '\n') 847 857 line[strlen(line)-1] = ' '; … … 852 862 if (sl_strlen(line) < 18) 853 863 continue; 864 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_STRTOK_R) 865 ptr = strtok_r (line, " ", &saveptr); 866 #else 854 867 ptr = strtok (line, " "); 868 #endif 855 869 while (ptr) 856 870 { 871 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_STRTOK_R) 872 ptr = strtok_r (NULL, " ", &saveptr); 873 #else 857 874 ptr = strtok (NULL, " "); 875 #endif 858 876 if (ptr && 0 == sl_strncmp (ptr, _("fingerprint"), 11)) 859 877 { 878 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_STRTOK_R) 879 ptr = strtok_r (NULL, " ", &saveptr); /* to '=' */ 880 #else 860 881 ptr = strtok (NULL, " "); /* to '=' */ 882 #endif 861 883 sign_fp[0] = '\0'; 862 884 while (ptr) 863 885 { 886 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_STRTOK_R) 887 ptr = strtok_r (NULL, " ", &saveptr); /* part of fingerprint */ 888 #else 864 889 ptr = strtok (NULL, " "); /* part of fingerprint */ 890 #endif 865 891 sl_strlcat (sign_fp, ptr, SH_MINIBUF+1); 866 892 } … … 923 949 #if defined(SH_WITH_SERVER) 924 950 struct passwd * tempres; 925 #endif 951 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 952 struct passwd pwd; 953 char buffer[SH_PWBUF_SIZE]; 954 #endif 955 #endif 956 926 957 #ifdef USE_FINGERPRINT 927 958 #include "sh_gpg_fp.h" … … 952 983 TPT(((0), FIL__, __LINE__, _("msg=<GPG_CHECK: FD1 = %d>\n"), fd1)); 953 984 #if defined(SH_WITH_SERVER) 985 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 986 sh_getpwnam_r(DEFAULT_IDENT, &pwd, buffer, sizeof(buffer), &tempres); 987 #else 954 988 tempres = sh_getpwnam(DEFAULT_IDENT); 989 #endif 955 990 956 991 if ((tempres != NULL) && (0 == sl_ret_euid())) … … 969 1004 TPT(((0), FIL__, __LINE__, _("msg=<GPG_CHECK: FD2 = %d>\n"), fd2)); 970 1005 #if defined(SH_WITH_SERVER) 1006 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 1007 sh_getpwnam_r(DEFAULT_IDENT, &pwd, buffer, sizeof(buffer), &tempres); 1008 #else 971 1009 tempres = sh_getpwnam(DEFAULT_IDENT); 1010 #endif 972 1011 973 1012 if ((tempres != NULL) && (0 == sl_ret_euid())) … … 1077 1116 1078 1117 #if defined(SH_WITH_SERVER) 1118 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 1119 struct passwd e_pwd; 1120 char e_buffer[SH_PWBUF_SIZE]; 1121 struct passwd * e_tempres; 1122 sh_getpwnam_r(DEFAULT_IDENT, &e_pwd, e_buffer, sizeof(e_buffer), &e_tempres); 1123 #else 1079 1124 struct passwd * e_tempres = sh_getpwnam(DEFAULT_IDENT); 1125 #endif 1080 1126 1081 1127 if ((e_tempres != NULL) && (0 == sl_ret_euid()))
Note:
See TracChangeset
for help on using the changeset viewer.