View | Details | Raw Unified | Return to bug 52313
Collapse All | Expand All

(-)htdbm.c (+35 lines)
Lines 97-102 Link Here
97
    char                    *comment;
97
    char                    *comment;
98
    char                    *type;
98
    char                    *type;
99
    int                     create;
99
    int                     create;
100
#if 11 /*##++##*/
101
    int                     keep;
102
    int                     allowcolon;
103
    int                     writevalue;
104
#endif /*##++##*/
100
    int                     rdonly;
105
    int                     rdonly;
101
    int                     alg;
106
    int                     alg;
102
};
107
};
Lines 191-196 Link Here
191
    key.dptr = htdbm->username;
196
    key.dptr = htdbm->username;
192
    key.dsize = strlen(htdbm->username);
197
    key.dsize = strlen(htdbm->username);
193
    if (apr_dbm_exists(htdbm->dbm, key))
198
    if (apr_dbm_exists(htdbm->dbm, key))
199
#if 11 /*##++##*/
200
        if (htdbm->keep) return APR_EEXIST; else
201
#endif /*##++##*/
194
        *changed = 1;
202
        *changed = 1;
195
203
196
    val.dsize = strlen(htdbm->userpass);
204
    val.dsize = strlen(htdbm->userpass);
Lines 234-239 Link Here
234
        pwd = apr_pstrndup(htdbm->pool, rec, cmnt - rec);
242
        pwd = apr_pstrndup(htdbm->pool, rec, cmnt - rec);
235
    else
243
    else
236
        pwd = apr_pstrdup(htdbm->pool, rec);
244
        pwd = apr_pstrdup(htdbm->pool, rec);
245
#if 11 /*##++##*/
246
    if (htdbm->writevalue) fwrite(val.dptr, 1, val.dsize, stdout);
247
#endif /*##++##*/
237
    return apr_password_validate(htdbm->userpass, pwd);
248
    return apr_password_validate(htdbm->userpass, pwd);
238
}
249
}
239
250
Lines 331-336 Link Here
331
        fprintf(stderr, "Invalid username length\n");
342
        fprintf(stderr, "Invalid username length\n");
332
        return APR_EINVAL;
343
        return APR_EINVAL;
333
    }
344
    }
345
#if 11 /*##++##*/
346
    if (!htdbm->allowcolon)
347
#endif /*##++##*/
334
    if (strchr(htdbm->username, ':')) {
348
    if (strchr(htdbm->username, ':')) {
335
        fprintf(stderr, "Username contains invalid characters\n");
349
        fprintf(stderr, "Username contains invalid characters\n");
336
        return APR_EINVAL;
350
        return APR_EINVAL;
Lines 347-354 Link Here
347
#define CRYPT_OPTION ""
361
#define CRYPT_OPTION ""
348
#endif
362
#endif
349
    fprintf(stderr, "htdbm -- program for manipulating DBM password databases.\n\n");
363
    fprintf(stderr, "htdbm -- program for manipulating DBM password databases.\n\n");
364
#if 11 /*##++##*/
365
    fprintf(stderr, "Usage: htdbm    [-ckam"CRYPT_OPTION"pstvwx] [-TDBTYPE] database username\n");
366
    fprintf(stderr, "                -b[ckam"CRYPT_OPTION"ptsvw] [-TDBTYPE] database username password\n");
367
#else /*##++##*/
350
    fprintf(stderr, "Usage: htdbm    [-cm"CRYPT_OPTION"pstvx] [-TDBTYPE] database username\n");
368
    fprintf(stderr, "Usage: htdbm    [-cm"CRYPT_OPTION"pstvx] [-TDBTYPE] database username\n");
351
    fprintf(stderr, "                -b[cm"CRYPT_OPTION"ptsv] [-TDBTYPE] database username password\n");
369
    fprintf(stderr, "                -b[cm"CRYPT_OPTION"ptsv] [-TDBTYPE] database username password\n");
370
#endif /*##++##*/
352
    fprintf(stderr, "                -n[m"CRYPT_OPTION"pst]   username\n");
371
    fprintf(stderr, "                -n[m"CRYPT_OPTION"pst]   username\n");
353
    fprintf(stderr, "                -nb[m"CRYPT_OPTION"pst]  username password\n");
372
    fprintf(stderr, "                -nb[m"CRYPT_OPTION"pst]  username password\n");
354
    fprintf(stderr, "                -v[m"CRYPT_OPTION"ps]    [-TDBTYPE] database username\n");
373
    fprintf(stderr, "                -v[m"CRYPT_OPTION"ps]    [-TDBTYPE] database username\n");
Lines 359-364 Link Here
359
    fprintf(stderr, "   -b   Use the password from the command line rather "
378
    fprintf(stderr, "   -b   Use the password from the command line rather "
360
                    "than prompting for it.\n");
379
                    "than prompting for it.\n");
361
    fprintf(stderr, "   -c   Create a new database.\n");
380
    fprintf(stderr, "   -c   Create a new database.\n");
381
#if 11 /*##++##*/
382
    fprintf(stderr, "   -w   Write database value to stdout (when verifying).\n");
383
    fprintf(stderr, "   -k   Keep existing entries; only new entries may be added.\n");
384
    fprintf(stderr, "   -a   Allow colons in username.\n");
385
#endif /*##++##*/
362
    fprintf(stderr, "   -n   Don't update database; display results on stdout.\n");
386
    fprintf(stderr, "   -n   Don't update database; display results on stdout.\n");
363
    fprintf(stderr, "   -m   Force MD5 encryption of the password (default).\n");
387
    fprintf(stderr, "   -m   Force MD5 encryption of the password (default).\n");
364
#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
388
#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
Lines 429-434 Link Here
429
            case 'c':
453
            case 'c':
430
                h->create = 1;
454
                h->create = 1;
431
                break;
455
                break;
456
#if 11 /*##++##*/
457
            case 'k':
458
                h->keep = 1;
459
                break;
460
            case 'a':
461
                h->allowcolon = 1;
462
                break;
463
            case 'w':
464
                h->writevalue = 1;
465
                break;
466
#endif /*##++##*/
432
            case 'n':
467
            case 'n':
433
                need_file = 0;
468
                need_file = 0;
434
                cmd = HTDBM_NOFILE;
469
                cmd = HTDBM_NOFILE;

Return to bug 52313