2 rpc.c - NSS lookup functions for rpc database
4 Copyright (C) 2006 West Consulting
5 Copyright (C) 2006, 2007, 2008 Arthur de Jong
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 #include "prototypes.h"
31 #include "compat/attrs.h"
33 static enum nss_status read_rpcent(
34 TFILE *fp,struct rpcent *result,
35 char *buffer,size_t buflen,int *errnop)
37 int32_t tmpint32,tmp2int32,tmp3int32;
39 READ_STRING_BUF(fp,result->r_name);
40 READ_STRINGLIST_NULLTERM(fp,result->r_aliases);
41 READ_INT32(fp,result->r_number);
42 return NSS_STATUS_SUCCESS;
45 enum nss_status _nss_ldap_getrpcbyname_r(const char *name,struct rpcent *result,char *buffer,size_t buflen,int *errnop)
47 NSS_BYNAME(NSLCD_ACTION_RPC_BYNAME,
49 read_rpcent(fp,result,buffer,buflen,errnop));
52 enum nss_status _nss_ldap_getrpcbynumber_r(int number,struct rpcent *result,char *buffer,size_t buflen,int *errnop)
54 NSS_BYINT32(NSLCD_ACTION_RPC_BYNUMBER,
56 read_rpcent(fp,result,buffer,buflen,errnop));
59 /* thread-local file pointer to an ongoing request */
60 static __thread TFILE *protoentfp;
62 enum nss_status _nss_ldap_setrpcent(int UNUSED(stayopen))
64 NSS_SETENT(protoentfp);
67 enum nss_status _nss_ldap_getrpcent_r(struct rpcent *result,char *buffer,size_t buflen,int *errnop)
69 NSS_GETENT(protoentfp,NSLCD_ACTION_RPC_ALL,
70 read_rpcent(protoentfp,result,buffer,buflen,errnop));
73 enum nss_status _nss_ldap_endrpcent(void)
75 NSS_ENDENT(protoentfp);