From owner-freebsd-questions@FreeBSD.ORG Fri Sep 30 18:30:38 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B08D16A41F for ; Fri, 30 Sep 2005 18:30:38 +0000 (GMT) (envelope-from rob@motionpath.com) Received: from mta07-winn.ispmail.ntl.com (mta07-winn.ispmail.ntl.com [81.103.221.47]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7655443D48 for ; Fri, 30 Sep 2005 18:30:37 +0000 (GMT) (envelope-from rob@motionpath.com) Received: from aamta11-winn.ispmail.ntl.com ([81.103.221.35]) by mta07-winn.ispmail.ntl.com with ESMTP id <20050930183036.RBEF21883.mta07-winn.ispmail.ntl.com@aamta11-winn.ispmail.ntl.com> for ; Fri, 30 Sep 2005 19:30:36 +0100 Received: from [10.0.1.87] (really [80.7.238.169]) by aamta11-winn.ispmail.ntl.com with ESMTP id <20050930183036.BJNE1770.aamta11-winn.ispmail.ntl.com@[10.0.1.87]> for ; Fri, 30 Sep 2005 19:30:36 +0100 Mime-Version: 1.0 (Apple Message framework v734) In-Reply-To: <200509301746.j8UHkh6x038676@spoon.beta.com> References: <200509301746.j8UHkh6x038676@spoon.beta.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6E00FF16-452F-4710-A9B7-C5BC3DFA476D@motionpath.com> Content-Transfer-Encoding: 7bit From: Rob Pitt Date: Fri, 30 Sep 2005 19:30:27 +0100 To: freebsd-questions@freebsd.org X-Mailer: Apple Mail (2.734) Subject: Re: Simple PAM authentication code? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2005 18:30:38 -0000 This is mostly taken from Linux Standards Base. Compile with -lpam - lpam_misc. HTH - RP #include #include #include int main(int argc, char *argv[]) { static struct pam_conv conv; conv.conv = misc_conv; conv.appdata_ptr = NULL; pam_handle_t *pamh; int pam_status; char *user; pam_status = pam_start("testing", NULL, &conv, &pamh); if (pam_status == PAM_SUCCESS) pam_status = pam_authenticate(pamh, 0); if (pam_status == PAM_SUCCESS) { pam_get_item(pamh, PAM_USER, (const void **)&user); fprintf(stdout, "Greetings %s\n", user); } else { printf("%s\n", pam_strerror(pamh, pam_status)); } pam_end(pamh, pam_status); } On 30 Sep 2005, at 18:46, Brian J. McGovern wrote: > Could someone point me at a short, straight forward bit of code that > validates a given username and password via PAM? I've tried writing > a short > app to make sure PAM is working the way I want to locally, but no > matter how > good the info, I'm getting an authentication denied, so I know I'm > missing something. > > The openpam site didn't seem to helpful documentation wise, and my > connection to > download the source seems to be timing out at the moment... > > -B > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions- > unsubscribe@freebsd.org" >