summaryrefslogtreecommitdiff
path: root/nss/rpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/rpc.c')
-rw-r--r--nss/rpc.c87
1 files changed, 43 insertions, 44 deletions
diff --git a/nss/rpc.c b/nss/rpc.c
index 4ebbf53..d285022 100644
--- a/nss/rpc.c
+++ b/nss/rpc.c
@@ -31,39 +31,38 @@
#include "compat/attrs.h"
/* read a sinlge rpc entry from the stream */
-static nss_status_t read_rpcent(
- TFILE *fp,struct rpcent *result,
- char *buffer,size_t buflen,int *errnop)
+static nss_status_t read_rpcent(TFILE *fp, struct rpcent *result,
+ char *buffer, size_t buflen, int *errnop)
{
- int32_t tmpint32,tmp2int32,tmp3int32;
- size_t bufptr=0;
- memset(result,0,sizeof(struct rpcent));
- READ_BUF_STRING(fp,result->r_name);
- READ_BUF_STRINGLIST(fp,result->r_aliases);
- READ_INT32(fp,result->r_number);
+ int32_t tmpint32, tmp2int32, tmp3int32;
+ size_t bufptr = 0;
+ memset(result, 0, sizeof(struct rpcent));
+ READ_BUF_STRING(fp, result->r_name);
+ READ_BUF_STRINGLIST(fp, result->r_aliases);
+ READ_INT32(fp, result->r_number);
return NSS_STATUS_SUCCESS;
}
#ifdef NSS_FLAVOUR_GLIBC
/* get a rpc entry by name */
-nss_status_t _nss_ldap_getrpcbyname_r(
- const char *name,struct rpcent *result,
- char *buffer,size_t buflen,int *errnop)
+nss_status_t _nss_ldap_getrpcbyname_r(const char *name,
+ struct rpcent *result, char *buffer,
+ size_t buflen, int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_RPC_BYNAME,
name,
- read_rpcent(fp,result,buffer,buflen,errnop));
+ read_rpcent(fp, result, buffer, buflen, errnop));
}
/* get a rpc entry by number */
-nss_status_t _nss_ldap_getrpcbynumber_r(
- int number,struct rpcent *result,
- char *buffer,size_t buflen,int *errnop)
+nss_status_t _nss_ldap_getrpcbynumber_r(int number, struct rpcent *result,
+ char *buffer, size_t buflen,
+ int *errnop)
{
NSS_BYINT32(NSLCD_ACTION_RPC_BYNUMBER,
number,
- read_rpcent(fp,result,buffer,buflen,errnop));
+ read_rpcent(fp, result, buffer, buflen, errnop));
}
/* thread-local file pointer to an ongoing request */
@@ -76,12 +75,11 @@ nss_status_t _nss_ldap_setrpcent(int UNUSED(stayopen))
}
/* get an rpc entry from the list */
-nss_status_t _nss_ldap_getrpcent_r(
- struct rpcent *result,
- char *buffer,size_t buflen,int *errnop)
+nss_status_t _nss_ldap_getrpcent_r(struct rpcent *result,
+ char *buffer, size_t buflen, int *errnop)
{
- NSS_GETENT(rpcentfp,NSLCD_ACTION_RPC_ALL,
- read_rpcent(rpcentfp,result,buffer,buflen,errnop));
+ NSS_GETENT(rpcentfp, NSLCD_ACTION_RPC_ALL,
+ read_rpcent(rpcentfp, result, buffer, buflen, errnop));
}
/* close the stream opened by setrpcent() above */
@@ -95,60 +93,60 @@ nss_status_t _nss_ldap_endrpcent(void)
#ifdef NSS_FLAVOUR_SOLARIS
#ifdef HAVE_STRUCT_NSS_XBYY_ARGS_RETURNLEN
-static char *rpcent2str(struct rpcent *result,char *buffer,size_t buflen)
+static char *rpcent2str(struct rpcent *result, char *buffer, size_t buflen)
{
- int res,i;
- res=snprintf(buffer,buflen,"%s %d",result->r_name,result->r_number);
- if ((res<0)||(res>=buflen))
+ int res, i;
+ res = snprintf(buffer, buflen, "%s %d", result->r_name, result->r_number);
+ if ((res < 0) || (res >= buflen))
return NULL;
if (result->r_aliases)
- for (i=0;result->r_aliases[i];i++)
+ for (i = 0; result->r_aliases[i]; i++)
{
- strlcat(buffer," ",buflen);
- strlcat(buffer,result->r_aliases[i],buflen);
+ strlcat(buffer, " ", buflen);
+ strlcat(buffer, result->r_aliases[i], buflen);
}
- if (strlen(buffer)>=buflen-1)
+ if (strlen(buffer) >= buflen - 1)
return NULL;
return buffer;
}
#endif /* HAVE_STRUCT_NSS_XBYY_ARGS_RETURNLEN */
-static nss_status_t read_result(TFILE *fp,nss_XbyY_args_t *args)
+static nss_status_t read_result(TFILE *fp, nss_XbyY_args_t *args)
{
- READ_RESULT(rpcent,&args->erange);
+ READ_RESULT(rpcent, &args->erange);
}
-static nss_status_t rpc_getrpcbyname(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t rpc_getrpcbyname(nss_backend_t UNUSED(*be), void *args)
{
NSS_BYNAME(NSLCD_ACTION_RPC_BYNAME,
NSS_ARGS(args)->key.name,
- read_result(fp,args));
+ read_result(fp, args));
}
-static nss_status_t rpc_getrpcbynumber(nss_backend_t UNUSED(*be),void *args)
+static nss_status_t rpc_getrpcbynumber(nss_backend_t UNUSED(*be), void *args)
{
NSS_BYINT32(NSLCD_ACTION_RPC_BYNUMBER,
NSS_ARGS(args)->key.number,
- read_result(fp,args));
+ read_result(fp, args));
}
-static nss_status_t rpc_setrpcent(nss_backend_t *be,void UNUSED(*args))
+static nss_status_t rpc_setrpcent(nss_backend_t *be, void UNUSED(*args))
{
NSS_SETENT(LDAP_BE(be)->fp);
}
-static nss_status_t rpc_getrpcent(nss_backend_t *be,void *args)
+static nss_status_t rpc_getrpcent(nss_backend_t *be, void *args)
{
- NSS_GETENT(LDAP_BE(be)->fp,NSLCD_ACTION_RPC_ALL,
- read_result(LDAP_BE(be)->fp,args));
+ NSS_GETENT(LDAP_BE(be)->fp, NSLCD_ACTION_RPC_ALL,
+ read_result(LDAP_BE(be)->fp, args));
}
-static nss_status_t rpc_endrpcent(nss_backend_t *be,void UNUSED(*args))
+static nss_status_t rpc_endrpcent(nss_backend_t *be, void UNUSED(*args))
{
NSS_ENDENT(LDAP_BE(be)->fp);
}
-static nss_backend_op_t rpc_ops[]={
+static nss_backend_op_t rpc_ops[] = {
nss_ldap_destructor,
rpc_endrpcent,
rpc_setrpcent,
@@ -158,9 +156,10 @@ static nss_backend_op_t rpc_ops[]={
};
nss_backend_t *_nss_ldap_rpc_constr(const char UNUSED(*db_name),
- const char UNUSED(*src_name),const char UNUSED(*cfg_args))
+ const char UNUSED(*src_name),
+ const char UNUSED(*cfg_args))
{
- return nss_ldap_constructor(rpc_ops,sizeof(rpc_ops));
+ return nss_ldap_constructor(rpc_ops, sizeof(rpc_ops));
}
#endif /* NSS_FLAVOUR_SOLARIS */