From owner-p4-projects Sun Jun 30 14:12:13 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5805437B400; Sun, 30 Jun 2002 14:11:58 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B344037B415 for ; Sun, 30 Jun 2002 14:11:56 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0096F43E09 for ; Sun, 30 Jun 2002 14:11:56 -0700 (PDT) (envelope-from des@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g5ULBtJU037942 for ; Sun, 30 Jun 2002 14:11:55 -0700 (PDT) (envelope-from des@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g5ULBtWW037939 for perforce@freebsd.org; Sun, 30 Jun 2002 14:11:55 -0700 (PDT) Date: Sun, 30 Jun 2002 14:11:55 -0700 (PDT) Message-Id: <200206302111.g5ULBtWW037939@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to des@freebsd.org using -f From: Dag-Erling Smorgrav Subject: PERFORCE change 13662 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=13662 Change 13662 by des@des.at.des.thinksec.com on 2002/06/30 14:11:38 Add the PAM_REPOSITORY item (from Solaris 9). Sponsored by: DARPA, NAI Labs Affected files ... .. //depot/projects/openpam/include/security/pam_constants.h#17 edit .. //depot/projects/openpam/lib/pam_get_item.c#13 edit .. //depot/projects/openpam/lib/pam_set_item.c#15 edit Differences ... ==== //depot/projects/openpam/include/security/pam_constants.h#17 (text+ko) ==== @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/include/security/pam_constants.h#16 $ + * $P4: //depot/projects/openpam/include/security/pam_constants.h#17 $ */ #ifndef _PAM_CONSTANTS_H_INCLUDED @@ -122,6 +122,7 @@ PAM_USER_PROMPT = 9, PAM_AUTHTOK_PROMPT = 10, /* OpenPAM extension */ PAM_OLDAUTHTOK_PROMPT = 11, /* OpenPAM extension */ + PAM_REPOSITORY = 12, PAM_NUM_ITEMS /* OpenPAM extension */ }; ==== //depot/projects/openpam/lib/pam_get_item.c#13 (text+ko) ==== @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/pam_get_item.c#12 $ + * $P4: //depot/projects/openpam/lib/pam_get_item.c#13 $ */ #include @@ -67,6 +67,7 @@ case PAM_USER_PROMPT: case PAM_AUTHTOK_PROMPT: case PAM_OLDAUTHTOK_PROMPT: + case PAM_REPOSITORY: *item = pamh->item[item_type]; return (PAM_SUCCESS); default: ==== //depot/projects/openpam/lib/pam_set_item.c#15 (text+ko) ==== @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/pam_set_item.c#14 $ + * $P4: //depot/projects/openpam/lib/pam_set_item.c#15 $ */ #include @@ -56,13 +56,12 @@ const void *item) { void **slot, *tmp; - size_t size; + size_t nsize, osize; if (pamh == NULL) return (PAM_SYSTEM_ERR); slot = &pamh->item[item_type]; - tmp = NULL; switch (item_type) { case PAM_SERVICE: case PAM_USER: @@ -74,27 +73,31 @@ case PAM_USER_PROMPT: case PAM_AUTHTOK_PROMPT: case PAM_OLDAUTHTOK_PROMPT: + if (item != NULL) + nsize = strlen(item) + 1; if (*slot != NULL) - size = strlen(*slot) + 1; - if (item != NULL) - if ((tmp = strdup(item)) == NULL) - return (PAM_BUF_ERR); + osize = strlen(*slot) + 1; + break; + case PAM_REPOSITORY: + osize = nsize = sizeof(struct pam_repository); break; case PAM_CONV: - size = sizeof(struct pam_conv); - if (item != NULL) { - if ((tmp = malloc(size)) == NULL) - return (PAM_BUF_ERR); - memcpy(tmp, item, sizeof(struct pam_conv)); - } + osize = nsize = sizeof(struct pam_conv); break; default: return (PAM_SYMBOL_ERR); } if (*slot != NULL) { - memset(*slot, 0xd0, size); + memset(*slot, 0xd0, osize); free(*slot); } + if (item != NULL) { + if ((tmp = malloc(nsize)) == NULL) + return (PAM_BUF_ERR); + memcpy(tmp, item, nsize); + } else { + tmp = NULL; + } *slot = tmp; return (PAM_SUCCESS); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message