From owner-freebsd-stable Wed Oct 23 16: 5:44 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1851137B401 for ; Wed, 23 Oct 2002 16:05:43 -0700 (PDT) Received: from stealth.siteplus.com (ns1.siteplus.com [66.129.2.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7AEBE43E42 for ; Wed, 23 Oct 2002 16:05:42 -0700 (PDT) (envelope-from jim@jwweeks.com) Received: from veager.jwweeks.com (pcp01076331pcs.midval01.tn.comcast.net [68.59.219.194]) by stealth.siteplus.com (8.12.5/8.12.5) with ESMTP id g9NN5RcA024364; Wed, 23 Oct 2002 19:05:28 -0400 (EDT) (envelope-from jim@jwweeks.com) Date: Wed, 23 Oct 2002 19:05:26 -0400 (EDT) From: Jim Weeks To: Chris BeHanna Cc: FreeBSD-Stable Subject: Re: Password Authentication question In-Reply-To: <20021023121442.X47335-100000@topperwein.pennasoft.com> Message-ID: <20021023185704.F1059-100000@veager.jwweeks.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > On Wed, 23 Oct 2002, Mark Hennessy wrote: > > I am trying to create an application that uses my existing passwd file to > > authenticate users via a web form. If you are writing your application in perl, this might be helpful. I sometimes use poppassd to authenticate directly from /etc/master.passwd with the follwing code. It probably could be cleaned up a bit, but you get the idea. use Socket; sub chkpass { $np = $form{'passwd'}; &open_TCP(PASSD, $host, $port) || &error ("Open Connection Fail"); # Get prompt $_ = ; # Send username print PASSD "user $SysUsr\n"; # Get password request $_ = ; # Send password print PASSD "pass $np\n"; # Get success(your new password please.) failure(Old password is incorrect.) $_ = ; if ($_ =~ /please/) { $success = "y"; } elsif ($_ =~ /incorrect/) { $failure = "y"; } # Quit cleanly print PASSD "quit\n"; $_ = ; if ($failure) { &error ("Incorrect password! Please hit your back button and try again."); } elsif ($success) { &setip; &welcome; } else { &error ("Unknown Password Error!") } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message