From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23580 invoked from network); 14 Feb 2002 22:30:52 -0000 Received: from unknown (HELO fencepost.gnu.org) (199.232.76.164) by sources.redhat.com with SMTP; 14 Feb 2002 22:30:52 -0000 Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian)) id 16bUOV-0001fI-00; Thu, 14 Feb 2002 17:30:23 -0500 Received: from gnats by fencepost.gnu.org with local (Exim 3.33 #1 (Debian)) id 16bUNR-0001Ud-00; Thu, 14 Feb 2002 17:29:17 -0500 From: Andrew.Gray@platypuspartners.com To: pdm-gnats@zamazal.org,gnats-prs@gnu.org,bug-gnats@gnu.org Reply-To: Andrew.Gray@platypuspartners.com Subject: gnats/342: Access denied when DES crypt() format passwords used in gnats.access Message-Id: Sender: gnats-prs-admin@gnu.org Errors-To: gnats-prs-admin@gnu.org X-BeenThere: gnats-prs@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Copies of bug tracking system messages List-Archive: Date: Thu, 14 Feb 2002 14:30:00 -0000 X-SW-Source: 2002-q1/txt/msg00062.txt.bz2 >Number: 342 >Category: gnats >Synopsis: Access denied when DES crypt() format passwords used in gnats.access >Confidential: no >Severity: serious >Priority: high >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Feb 14 17:29:17 -0500 2002 >Originator: Andrew Gray >Release: 3.999.1 >Organization: >Environment: Intel, Linux 2.4.2-1, RedHat 7.1 distribution, libcrypt 2.2.4 >Description: When DES crypt() format passwords are used in the gnats.access file, access is denied even when the correct password is given. >How-To-Repeat: Compile the attached crypt.c source file using: gcc crypt.c -o crypt -lcrypt Generate encrypt the password "sample": ./crypt sample In my case the encrypted password was "dQADNeZKYriCU", the time-based salt will change the result. Edit the /usr/local/com/gnatsdb/gnats-adm/gnats.access file to include the following line: testuser:dQADNeZKYriCU:edit Run the command: query-pr -H localhost -v testuser -w sample 1 The output of the command is: query-pr: access denied The expected output is a summary of problem report 1. >Fix: Apply the following patch to gnatsd.c. The documentation says that "passwords encrypted by crypt()" should have no prefix, but the current code assumes that the default password format is plain text. The patch changes the code so that passwords with no prefix are taken to be encrypted by crypt(). Index: gnatsd.c =================================================================== RCS file: /cvsroot/gnats/gnats/gnats/gnatsd.c,v retrieving revision 1.45 diff -u -p -r1.45 gnatsd.c --- gnatsd.c 23 Dec 2001 20:22:08 -0000 1.45 +++ gnatsd.c 14 Feb 2002 22:21:34 -0000 @@ -272,8 +272,14 @@ password_match (const char *password, co } else { - /* default password type is plain-text */ - return match (password, hash, TRUE); + /* default password type is DES crypt */ +#ifdef HAVE_LIBCRYPT + char *encrypted = crypt (password, hash); + return encrypted && ! strcmp (encrypted, hash); +#else + /* TODO: log some warning */ + return FALSE; +#endif } } >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="crypt.c" Content-Disposition: inline; filename="crypt.c" /* $Id: crypt.c,v 1.2 2002/02/14 22:02:40 andrewg Exp $ */ /* Program to encrypt passwords using crypt function * for use with GNATS. * Compile with "gcc crypt.c -o crypt -lcrypt" on pindari */ #define _XOPEN_SOURCE #include #include #include main (int argc, char **argv) { char *result; char salt[2]; struct timeval tv; int i; if (argc != 2 && argc != 3) { fprintf(stderr, "usage: %s password [ salt ]\n", argv[0]); exit(2); } if (argc == 3) result = crypt(argv[1], argv[2]); else { if (gettimeofday(&tv, (struct timezone *)0)) { perror("gettimeofday"); exit(2); } salt[0] = tv.tv_usec & 0x3F; salt[1] = tv.tv_sec & 0x3F; for (i = 0; i < 2; i++) { salt[i] += 46; if (salt[i] > 57) { salt[i] += 7; if (salt[i] > 90) salt[i] += 6; } } result = crypt(argv[1], salt); } printf("%s\n", result); } _______________________________________________ Gnats-prs mailing list Gnats-prs@gnu.org http://mail.gnu.org/mailman/listinfo/gnats-prs