]> git.pld-linux.org Git - packages/apache1.git/blame - apache1-htpasswd_do_not_trash_extra_fields.patch
rel 15; builds
[packages/apache1.git] / apache1-htpasswd_do_not_trash_extra_fields.patch
CommitLineData
bfc879b9
ER
1diff -Naurd build-tree.orig/apache_1.3.34/src/support/htpasswd.c build-tree/apache_1.3.34/src/support/htpasswd.c
2--- build-tree.orig/apache_1.3.34/src/support/htpasswd.c 2004-05-05 11:24:30.000000000 +0200
3+++ build-tree/apache_1.3.34/src/support/htpasswd.c 2004-05-05 11:23:45.000000000 +0200
4@@ -369,6 +369,7 @@
5 char record[MAX_STRING_LEN];
6 char line[MAX_STRING_LEN];
7 char pwfilename[MAX_STRING_LEN];
8+ char extrafields[MAX_STRING_LEN];
9 char *arg;
10 int found = 0;
11 int alg = ALG_CRYPT;
12@@ -381,6 +382,8 @@
13
14 signal(SIGINT, (void (*)(int)) interrupted);
15
16+ extrafields[0] = '\0'; /* be sure it is initialized properly */
17+
18 /*
19 * Preliminary check to make sure they provided at least
20 * three arguments, we'll do better argument checking as
21@@ -610,6 +613,14 @@
22 putline(ftemp, line);
23 continue;
24 }
25+ strcpy(scratch, line); /* make a clean copy of line */
26+ colon = strchr(scratch, ':'); /* skip the username */
27+ colon = strchr(colon+1, ':'); /* skip the password */
28+ if (colon != NULL) { /* if != NULL there are extrafields */
29+ strcpy(extrafields,colon); /* copy them */
30+ } else {
31+ extrafields[0] = '\0'; /* if not be sure that it is empty! */
32+ }
33 found++;
34 break;
35 }
36@@ -624,6 +635,9 @@
37 /*
38 * Now add the user record we created.
39 */
40+ if (strlen(extrafields) > 0) {
41+ strcat(record,extrafields);
42+ }
43 putline(ftemp, record);
44 /*
45 * If we're updating an existing file, there may be additional
This page took 0.036274 seconds and 4 git commands to generate.