You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2026/05/03 17:04:12 UTC

[Bug 52313] htdbm enhancement: options for colon-in-username, no-overwrite, extract-entry

https://bz.apache.org/bugzilla/show_bug.cgi?id=52313

Ketty perry <ke...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #36256|htdbm enhancement: options  |clontzsteven7@gmail.com
        description|for colon-in-username,      |enhancement: options for
                   |no-overwrite, extract-entry |colon-in-username,
                   |                            |no-overwrite, extract-entry
  Attachment #36256|htdbm.patch                 |clontzsteven7@gmail.com.pat
           filename|                            |ch
  Attachment #36256|0                           |1
        is obsolete|                            |

--- Comment #9 from Ketty perry <ke...@gmail.com> ---
Comment on attachment 36256
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36256
clontzsteven7@gmail.com enhancement: options for colon-in-username,
no-overwrite, extract-entry

>diff -Naur a/support/clontzsteven7@gmail.com.  c b/support/clontzsteven7@gmail.com.c
>--- a/support/htdbm.c	2013-03-11 16:38:39.000000000 +0000
>+++ b/support/clontzsteven7@gmail.com.c	2018-11-09 09:51:57.371753575 +0000
>@@ -68,6 +68,9 @@
>     char                    *comment;
>     char                    *type;
>     int                     create;
>+    int                     allowcolon;
>+    int                     keep;
>+    int                     writevalue;
>     int                     rdonly;
> };
> 
>@@ -161,8 +164,11 @@
> 
>     key.dptr = clontzsteven7@gmail.com
->username;
>     key.dsize = strlen(clontzsteven7@gmail.com->username);
>-    if (apr_dbm_exists(clontzsteven7@gmail.com->dbm, key))
>+    if (apr_dbm_exists(clontzsteven7@gmail.com->dbm, key)) {
>+        if (clontzsteven7@gmail.com->keep)
>+            return APR_EEXIST;
>         *changed = 1;
>+    }
> 
>     val.dsize = strlen(clontzsteven7@gmail.com->ctx.passwd);
>     if (!htdbm->comment)
>@@ -205,6 +211,7 @@
>         pwd = apr_pstrndup(clontzsteven7@gmail.com->ctx.pool, rec, cmnt - rec);
>     else
>         pwd = apr_pstrdup(htdbm->ctx.pool, rec);
>+    if (clontzsteven7@gmail.com->writevalue) fwrite(val.dptr, 1, val.dsize, stdout);
>     return apr_password_validate(clontzsteven7@gmail.com->ctx.passwd, pwd);
> }
> 
>@@ -266,7 +273,7 @@
>         fprintf(stderr, "Invalid username length\n");
>         return APR_EINVAL;
>     }
>-    if (strchr(clontzsteven7@gmail.com->username, ':')) {
>+    if (! clontzsteven7@gmail.com->allowcolon && strchr(htdbm->username, ':')) {
>         fprintf(stderr, "Username contains invalid characters\n");
>         return APR_EINVAL;
>     }
>@@ -277,14 +284,14 @@
> {
>     fprintf(stderr,
>         "clontzsteven7@gmail.com -- program for manipulating DBM password databases.\n\n"
>-        "Usage: clontzsteven7@gmail.com   [-cimBdpstvx] [-C cost] [-TDBTYPE] database username\n"
>-        "                -b[cmBdptsv] [-C cost] [-TDBTYPE] database username password\n"
>-        "                -n[imBdpst]  [-C cost] username\n"
>-        "                -nb[mBdpst]  [-C cost] username password\n"
>-        "                -v[imBdps]   [-C cost] [-TDBTYPE] database username\n"
>-        "                -vb[mBdps]   [-C cost] [-TDBTYPE] database username password\n"
>-        "                -x                     [-TDBTYPE] database username\n"
>-        "                -l                     [-TDBTYPE] database\n"
>+        "Usage: clontzsteven7@gmail.com   [-cimBdpstvxak] [-C cost] [-TDBTYPE] database username\n"
>+        "                -b[cmBdptsvak] [-C cost] [-TDBTYPE] database username password\n"
>+        "                -n[imBdpst]    [-C cost] username\n"
>+        "                -nb[mBdpst]    [-C cost] username password\n"
>+        "                -v[imBdpsw]    [-C cost] [-TDBTYPE] database username\n"
>+        "                -vb[mBdpsw]    [-C cost] [-TDBTYPE] database username password\n"
>+        "                -x                       [-TDBTYPE] database username\n"
>+        "                -l                       [-TDBTYPE] database\n"
>         "Options:\n"
>         "   -c   Create a new database.\n"
>         "   -n   Don't update database; display results on stdout.\n"
>@@ -302,6 +309,9 @@
>         "   -v   Verify the username/password.\n"
>         "   -x   Remove the username record from database.\n"
>         "   -t   The last param is username comment.\n"
>+        "   -a   Allow colons in username.\n"
>+        "   -k   Keep existing entries; only new entries may be added.\n"
>+        "   -w   Write database value to stdout (when verifying).\n"
>         "The SHA algorithm does not use a salt and is less secure than the "
>         "MD5 algorithm.\n",
>         BCRYPT_DEFAULT_COST);
>@@ -337,7 +347,7 @@
>     if (rv != APR_SUCCESS)
>         exit(ERR_SYNTAX);
> 
>-    while ((rv = apr_getopt(state, "cnmspdBbDivxlC:T:", &opt, &opt_arg)) == APR_SUCCESS) {
>+    while ((rv = apr_getopt(state, "akwtcnmspdBbDivxlC:T:", &opt, &opt_arg)) == APR_SUCCESS) {
>         switch (opt) {
>         case 'c':
>             h->create = 1;
>@@ -369,6 +379,15 @@
>             need_pwd = 0;
>             cmd = HTDBM_DELETE;
>             break;
>+        case 'a':
>+            h->allowcolon = 1;
>+            break;
>+        case 'k':
>+            h->keep = 1;
>+            break;
>+        case 'w':
>+            h->writevalue = 1;
>+            break;
>         default:
>             ret = parse_common_options(&h->ctx, opt, opt_arg);
>             if (ret) {

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org