Changeset 208
- Timestamp:
- 05/12/04 00:46:53 (5 years ago)
- Files:
-
- op/trunk/main.c (modified) (7 diffs)
- op/trunk/Makefile (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
op/trunk/main.c
r207 r208 360 360 if ((pw = getpwuid(getuid())) == NULL) return -1; 361 361 362 #ifdef SECURID362 #ifdef SECURID 363 363 if ((cp=FindOpt(cmd, "securid")) != NULL) { 364 364 memset(&sd_dat, 0, sizeof(sd_dat)); /* clear sd_auth struct */ … … 370 370 if (sd_auth(sd)) return -1; 371 371 } 372 #else372 #else 373 373 if ((cp=FindOpt(cmd, "securid")) != NULL) { 374 374 return logger(LOG_ERR | LOG_PRINT, "SecureID not supported by op. Access denied"); 375 375 } 376 #endif376 #endif 377 377 378 378 if ((cp=FindOpt(cmd, "password")) != NULL) { … … 405 405 return logger(LOG_ERR, "Incorrect direct password"); 406 406 } else { 407 #ifdef USE_SHADOW407 #ifdef USE_SHADOW 408 408 if (strcmp(pw->pw_passwd,"x")==0){ /* Shadow passwords */ 409 409 if ((spw = getspnam(pw->pw_name)) == NULL) … … 411 411 pw->pw_passwd=spw->sp_pwdp; 412 412 } 413 #endif413 #endif 414 414 415 415 if (!cp && strcmp(crypt(np, pw->pw_passwd), pw->pw_passwd) != 0) … … 1034 1034 } 1035 1035 1036 #ifndef HAVE_SNPRINTF 1037 #warning You have not compiled op with snprintf support, presumably because 1038 #warning your system does not have it. This leaves op potentially open to 1039 #warning buffer overflows. 1040 #endif 1041 1036 1042 int vlogger(unsigned level, const char *format, va_list args) { 1037 1043 char buffer[MAXSTRLEN], buffer2[MAXSTRLEN], buffer3[MAXSTRLEN]; … … 1040 1046 if (realuser) username = realuser->pw_name; 1041 1047 1048 #ifdef HAVE_SNPRINTF 1042 1049 vsnprintf(buffer2, MAXSTRLEN, format, args); 1050 #else 1051 vsprintf(buffer2, format, args); 1052 #endif 1043 1053 if (level & LOG_PRINT) printf("%s\n", buffer2); 1044 1054 level &= ~LOG_PRINT; 1055 #ifdef HAVE_SNPRINTF 1045 1056 snprintf(buffer, MAXSTRLEN, "%s =>%s: %s", username, 1046 1057 format_cmd(gargc, gargv, buffer3, MAXSTRLEN), 1047 1058 buffer2); 1059 #else 1060 sprintf(buffer, "%s =>%s: %s", username, 1061 format_cmd(gargc, gargv, buffer3, MAXSTRLEN), 1062 buffer2); 1063 #endif 1048 1064 syslog(level, "%s", buffer); 1049 1065 return -1; … … 1064 1080 1065 1081 va_start(ap, format); 1082 #ifdef HAVE_SNPRINTF 1066 1083 vsnprintf(buffer, MAXSTRLEN, format, ap); 1084 #else 1085 vsprintf(buffer, format, ap); 1086 #endif 1067 1087 fprintf(stderr, "%s\n", buffer); 1068 1088 if (logit) logger(LOG_ERR, "%s", buffer); op/trunk/Makefile
r207 r208 23 23 # 24 24 #OPTS= -DUSE_SHADOW -g 25 OPTS= -DXAUTH=\"/usr/X11R6/bin/xauth\" -DUSE_PAM - g25 OPTS= -DXAUTH=\"/usr/X11R6/bin/xauth\" -DUSE_PAM -DHAVE_SNPRINTF -g 26 26 LDFLAGS = -g 27 27 #
