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

Ketty perry <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #36256|htdbm enhancement: options  |[email protected]
        description|for colon-in-username,      |enhancement: options for
                   |no-overwrite, extract-entry |colon-in-username,
                   |                            |no-overwrite, extract-entry
  Attachment #36256|htdbm.patch                 |[email protected]
           filename|                            |ch
  Attachment #36256|0                           |1
        is obsolete|                            |

--- Comment #9 from Ketty perry <[email protected]> ---
Comment on attachment 36256
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36256
[email protected] enhancement: options for colon-in-username,
no-overwrite, extract-entry

>diff -Naur a/support/[email protected].  c 
>b/support/[email protected]
>--- a/support/htdbm.c  2013-03-11 16:38:39.000000000 +0000
>+++ b/support/[email protected]        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 = [email protected]
->username;
>     key.dsize = strlen([email protected]>username);
>-    if (apr_dbm_exists([email protected]>dbm, key))
>+    if (apr_dbm_exists([email protected]>dbm, key)) {
>+        if ([email protected]>keep)
>+            return APR_EEXIST;
>         *changed = 1;
>+    }
> 
>     val.dsize = strlen([email protected]>ctx.passwd);
>     if (!htdbm->comment)
>@@ -205,6 +211,7 @@
>         pwd = apr_pstrndup([email protected]>ctx.pool, rec, cmnt - 
> rec);
>     else
>         pwd = apr_pstrdup(htdbm->ctx.pool, rec);
>+    if ([email protected]>writevalue) fwrite(val.dptr, 1, val.dsize, 
>stdout);
>     return apr_password_validate([email protected]>ctx.passwd, pwd);
> }
> 
>@@ -266,7 +273,7 @@
>         fprintf(stderr, "Invalid username length\n");
>         return APR_EINVAL;
>     }
>-    if (strchr([email protected]>username, ':')) {
>+    if (! [email protected]>allowcolon && strchr(htdbm->username, 
>':')) {
>         fprintf(stderr, "Username contains invalid characters\n");
>         return APR_EINVAL;
>     }
>@@ -277,14 +284,14 @@
> {
>     fprintf(stderr,
>         "[email protected] -- program for manipulating DBM password 
> databases.\n\n"
>-        "Usage: [email protected]   [-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: [email protected]   [-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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to