From owner-freebsd-hackers Sun Aug 17 12:24:15 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id MAA16695 for hackers-outgoing; Sun, 17 Aug 1997 12:24:15 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.50]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id MAA16685 for ; Sun, 17 Aug 1997 12:24:08 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id MAA07163; Sun, 17 Aug 1997 12:17:24 -0700 From: Terry Lambert Message-Id: <199708171917.MAA07163@phaeton.artisoft.com> Subject: Re: Password Handling To: jamil@counterintelligence.ml.org (Jamil J. Weatherbee) Date: Sun, 17 Aug 1997 12:17:23 -0700 (MST) Cc: freebsd-hackers@FreeBSD.ORG In-Reply-To: from "Jamil J. Weatherbee" at Aug 16, 97 05:38:12 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > I've been looking through the source code to login.c and various .h files, > can someone tell me why login.c defines NBUFSIZE (size of the login name > buffer i think) as UT_NAMESIZE+64, where UT_NAMESIZE is 8 (from utmp.h), Read the comment immediately before the definition: "Allow for authentication style and/or kerberos instance" Then read the 20 or so lines of code immediately below the comment... the point is to allow the input of options for kerberos or another authentication style argument, in addition to the user name. > even though MAXLOGNAME from sys/param.h is 12. sys/param.h is a kernel header. Ignore values there unless you are talking to kernel interfaces (published or via libkvm grovelling in /dev/kmem). > The reason I am asking is that I am designing a server that requires > user logins (I have looked at ftpd.c also) and am wondering if it is > appropriate to use the figure in sys/param.h as the max user name length. No. Use the value from utmp.h, it is the value the rest of the system will use. Sidebar: You must be running old code if this value is 8. > Also another thing that confuses me a bit with freebsd is crypt is > systems that use DES you can do a crypt on the plain text and a > strcmp against the encrypted password returned from getpwnam(), in > freebsd with shadowed passwords and either md5 or des are password > checks handled the same assuming your daemon is running uid 0? The actual password field values are accessable only to root. If they were not, then your system would be succeptible to password cracking techniques, including dictionary-based attacks. Your daemon should verify the user credentials, and then give up uid 0 in favor of the uid associated with the credentials. This assumes that the daemon is verifying the credentials against the system user database, and not a service-specific user database... probably the case, or your question would be meaningless (if a daemon is maintaining it's own user database, it can maintain it however it wants, shadow passwords or not, etc.). Things which verify passwords are gatekeepers; you must be able to trust your gatekeepers with the keys to the gate. Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.