10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 22*132Srobinson 230Sstevel@tonic-gate /* 24*132Srobinson * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 250Sstevel@tonic-gate * Use is subject to license terms. 260Sstevel@tonic-gate */ 270Sstevel@tonic-gate 280Sstevel@tonic-gate /* 290Sstevel@tonic-gate * Ye olde non-reentrant interface (MT-unsafe, caveat utor) 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 330Sstevel@tonic-gate 340Sstevel@tonic-gate #include <rpc/rpcent.h> 350Sstevel@tonic-gate #include <nss_dbdefs.h> 360Sstevel@tonic-gate 370Sstevel@tonic-gate #ifdef NSS_INCLUDE_UNSAFE 380Sstevel@tonic-gate 390Sstevel@tonic-gate /* 400Sstevel@tonic-gate * Don't free this, even on an endrpcent(), because bitter experience shows 410Sstevel@tonic-gate * that there's production code that does getXXXbyYYY(), then endXXXent(), 420Sstevel@tonic-gate * and then continues to use the pointer it got back. 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate static nss_XbyY_buf_t *buffer; 450Sstevel@tonic-gate #define GETBUF() \ 460Sstevel@tonic-gate NSS_XbyY_ALLOC(&buffer, sizeof (struct rpcent), NSS_BUFLEN_RPC) 470Sstevel@tonic-gate /* === ?? set ENOMEM on failure? */ 480Sstevel@tonic-gate 490Sstevel@tonic-gate struct rpcent * 50*132Srobinson getrpcbyname(const char *nam) 510Sstevel@tonic-gate { 520Sstevel@tonic-gate nss_XbyY_buf_t *b; 530Sstevel@tonic-gate 54*132Srobinson if ((b = GETBUF()) == 0) 55*132Srobinson return (NULL); 56*132Srobinson return (getrpcbyname_r(nam, b->result, b->buffer, b->buflen)); 570Sstevel@tonic-gate } 580Sstevel@tonic-gate 590Sstevel@tonic-gate struct rpcent * 60*132Srobinson getrpcbynumber(const int num) 610Sstevel@tonic-gate { 620Sstevel@tonic-gate nss_XbyY_buf_t *b; 630Sstevel@tonic-gate 64*132Srobinson if ((b = GETBUF()) == 0) 65*132Srobinson return (NULL); 66*132Srobinson return (getrpcbynumber_r(num, b->result, b->buffer, b->buflen)); 670Sstevel@tonic-gate } 680Sstevel@tonic-gate 690Sstevel@tonic-gate struct rpcent * 70*132Srobinson getrpcent(void) 710Sstevel@tonic-gate { 720Sstevel@tonic-gate nss_XbyY_buf_t *b; 730Sstevel@tonic-gate 74*132Srobinson if ((b = GETBUF()) == 0) 75*132Srobinson return (NULL); 76*132Srobinson return (getrpcent_r(b->result, b->buffer, b->buflen)); 770Sstevel@tonic-gate } 780Sstevel@tonic-gate #endif /* NSS_INCLUDE_UNSAFE */ 79