Link Here
|
1 |
--- extras/htpasswd.c.orig 2001-12-19 00:08:08 UTC |
1 |
--- extras/htpasswd.c.orig 2017-12-13 16:35:28 UTC |
2 |
+++ extras/htpasswd.c |
2 |
+++ extras/htpasswd.c |
3 |
@@ -19,7 +19,12 @@ |
3 |
@@ -19,7 +19,12 @@ |
4 |
#define LF 10 |
4 |
#define LF 10 |
Link Here
|
25 |
exit(1); |
25 |
exit(1); |
26 |
} |
26 |
} |
27 |
|
27 |
|
28 |
@@ -149,51 +155,128 @@ void interrupted(int signo) { |
28 |
@@ -149,52 +155,131 @@ void interrupted(int signo) { |
29 |
int main(int argc, char *argv[]) { |
29 |
int main(int argc, char *argv[]) { |
30 |
FILE *tfp,*f; |
30 |
FILE *tfp,*f; |
31 |
char user[MAX_STRING_LEN]; |
31 |
char user[MAX_STRING_LEN]; |
Link Here
|
138 |
+ exit(1); |
138 |
+ exit(1); |
139 |
+ } |
139 |
+ } |
140 |
+ /* already checked for boflw ... */ |
140 |
+ /* already checked for boflw ... */ |
141 |
strcpy(user,argv[2]); |
141 |
strncpy(user,argv[2],sizeof(user)-1); |
|
|
142 |
user[sizeof(user)-1] = '\0'; |
142 |
|
143 |
|
143 |
found = 0; |
144 |
found = 0; |
144 |
- while(!(my_getline(line,MAX_STRING_LEN,f))) { |
145 |
- while(!(my_getline(line,MAX_STRING_LEN,f))) { |
Link Here
|
150 |
putline(tfp,line); |
151 |
putline(tfp,line); |
151 |
continue; |
152 |
continue; |
152 |
} |
153 |
} |
153 |
- strcpy(l,line); |
154 |
strcpy(l,line); |
154 |
- getword(w,l,':'); |
155 |
getword(w,l,':'); |
155 |
+ i = index(line,':'); |
156 |
+ i = index(line,':'); |
156 |
+ w[0] = '\0'; |
157 |
+ w[0] = '\0'; |
157 |
+ /* actually, cpw is CPW_LEN chars and never null, hence ':' should |
158 |
+ /* actually, cpw is CPW_LEN chars and never null, hence ':' should |
Link Here
|
166 |
if(strcmp(user,w)) { |
167 |
if(strcmp(user,w)) { |
167 |
putline(tfp,line); |
168 |
putline(tfp,line); |
168 |
continue; |
169 |
continue; |
169 |
@@ -208,10 +291,28 @@ int main(int argc, char *argv[]) { |
170 |
@@ -209,10 +294,28 @@ int main(int argc, char *argv[]) { |
170 |
printf("Adding user %s\n",user); |
171 |
printf("Adding user %s\n",user); |
171 |
add_password(user,tfp); |
172 |
add_password(user,tfp); |
172 |
} |
173 |
} |