Changeset 215
- Timestamp:
- 04/06/05 09:45:26 (4 years ago)
- Files:
-
- op/trunk/defs.h (modified) (2 diffs)
- op/trunk/main.c (modified) (4 diffs)
- op/trunk/Makefile (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
op/trunk/defs.h
r213 r215 32 32 33 33 int ReadFile(char *file); 34 int ReadDir(char *dir); 34 35 int CountArgs(cmd_t *cmd); 35 36 int atov(char *str, int type); … … 37 38 #define MAXSTRLEN 2048 38 39 #define OP_ACCESS "/etc/op.conf" 39 #define VERSION "1.25" 40 #define OP_ACCESS_DIR "/etc/op.d" 41 #define VERSION "1.26" 40 42 41 43 #define VAR_EXPAND_LEN 8192 op/trunk/main.c
r213 r215 25 25 #include <ctype.h> 26 26 #include <string.h> 27 #include <dirent.h> 27 28 #include "defs.h" 28 29 #include "regexp.h" … … 89 90 } 90 91 92 int ReadDir( char *dir ) 93 { 94 DIR *d; 95 96 if ((d = opendir(dir)) != NULL) 97 { 98 struct dirent *f; 99 int successes = 0; 100 101 while ((f = readdir(d))) 102 { 103 char full_path[PATH_MAX]; 104 105 if (f->d_name[0] == '.' || (strlen(f->d_name) > 5 && strcmp(f->d_name + strlen(f->d_name) - 5, ".conf"))) 106 continue; 107 #ifdef HAVE_SNPRINTF 108 snprintf(full_path, PATH_MAX, "%s/%s", OP_ACCESS_DIR, f->d_name); 109 #else 110 sprintf(full_path, "%s/%s", OP_ACCESS_DIR, f->d_name); 111 #endif 112 if (ReadFile(full_path)) 113 ++successes; 114 } 115 closedir(d); 116 return successes; 117 } 118 return 0; 119 } 120 91 121 int main(argc, argv) 92 122 int argc; … … 97 127 cmd_t *cmd, *def, *new; 98 128 struct passwd *pw; 99 int hflag = 0 ;129 int hflag = 0, read_conf = 0, read_conf_dir = 0; 100 130 char *uptr = NULL; 101 131 char cmd_s[MAXSTRLEN]; … … 161 191 fatal(0, "openlog failed"); 162 192 #endif 163 ReadFile( OP_ACCESS ); 193 read_conf = ReadFile( OP_ACCESS ); 194 read_conf_dir = ReadDir( OP_ACCESS_DIR ); 195 196 if (!read_conf && !read_conf_dir) 197 fatal(1, "Could not open %s or any configuration files in %s", OP_ACCESS, OP_ACCESS_DIR); 164 198 165 199 if (hflag) { op/trunk/Makefile
r210 r215 4 4 CC=gcc 5 5 INC= -I. -Wall 6 LIBS= -ll -L/lib -l pam -lcrypt6 LIBS= -ll -L/lib -lcrypt 7 7 DESTDIR= 8 8 PREFIX=/usr 9 CONFDIR= $(DESTDIR)/etc/op.d 9 10 BINDIR= $(DESTDIR)$(PREFIX)/bin 10 11 BINOWN= root … … 20 21 #GLOBALOPTS=-DDEBUG 21 22 # 22 # Linux 2.0.3023 # Linux with PAM 23 24 # 24 #OPTS= -DUSE_SHADOW -g 25 OPTS= -DXAUTH=\"/usr/X11R6/bin/xauth\" -DUSE_PAM -DHAVE_SNPRINTF -g 26 LDFLAGS = -g 25 #OPTS= -DXAUTH=\"/usr/X11R6/bin/xauth\" -DUSE_PAM -DHAVE_SNPRINTF -g 26 #LDFLAGS = -g -lpam 27 # 28 # Linux without PAM (eg. Slackware) 29 # 30 OPTS= -DXAUTH=\"/usr/X11R6/bin/xauth\" -DHAVE_SNPRINTF -DUSE_SHADOW -g 27 31 # 28 32 # … … 78 82 op.list: op.list.in 79 83 sed -e "s/@VERSION@/`grep VERSION defs.h | cut -d\\\" -f2`/" < op.list.in > op.list 80 install: install-prog install-man 81 install-prog: 84 install: op 82 85 mkdir -p $(BINDIR) 83 86 $(INSTALL) 84 install-man:85 87 mkdir -p $(MANDIR) 86 88 $(INSTALL-MAN) 89 mkdir -p $(CONFDIR) 87 90 88 91 pkg: op
