14520Snw141292 /* 24520Snw141292 * CDDL HEADER START 34520Snw141292 * 44520Snw141292 * The contents of this file are subject to the terms of the 54520Snw141292 * Common Development and Distribution License (the "License"). 64520Snw141292 * You may not use this file except in compliance with the License. 74520Snw141292 * 84520Snw141292 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 94520Snw141292 * or http://www.opensolaris.org/os/licensing. 104520Snw141292 * See the License for the specific language governing permissions 114520Snw141292 * and limitations under the License. 124520Snw141292 * 134520Snw141292 * When distributing Covered Code, include this CDDL HEADER in each 144520Snw141292 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 154520Snw141292 * If applicable, add the following below this CDDL HEADER, with the 164520Snw141292 * fields enclosed by brackets "[]" replaced with your own identifying 174520Snw141292 * information: Portions Copyright [yyyy] [name of copyright owner] 184520Snw141292 * 194520Snw141292 * CDDL HEADER END 204520Snw141292 */ 214520Snw141292 /* 224520Snw141292 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 234520Snw141292 * Use is subject to license terms. 244520Snw141292 */ 254520Snw141292 264520Snw141292 #pragma ident "%Z%%M% %I% %E% SMI" 274520Snw141292 284520Snw141292 /* 294520Snw141292 * RPC service routines 304520Snw141292 * It was initially generated using rpcgen. 314520Snw141292 */ 324520Snw141292 334520Snw141292 #include "idmapd.h" 344520Snw141292 #include "idmap_prot.h" 354520Snw141292 #include <stdlib.h> 364520Snw141292 #include <signal.h> 374520Snw141292 #include <rpc/xdr.h> 384520Snw141292 #include <rpc/rpc.h> 394520Snw141292 #include <string.h> 404520Snw141292 #include <thread.h> 414520Snw141292 #include <synch.h> 424520Snw141292 434520Snw141292 444520Snw141292 /* ARGSUSED */ 454520Snw141292 int 464520Snw141292 _idmap_null_1(void *argp, void *result, struct svc_req *rqstp) 474520Snw141292 { 484520Snw141292 return (idmap_null_1_svc(result, rqstp)); 494520Snw141292 } 504520Snw141292 514520Snw141292 int 524520Snw141292 _idmap_get_mapped_ids_1(idmap_mapping_batch *argp, idmap_ids_res *result, 534520Snw141292 struct svc_req *rqstp) { 544520Snw141292 return (idmap_get_mapped_ids_1_svc(*argp, result, rqstp)); 554520Snw141292 } 564520Snw141292 574520Snw141292 int 584520Snw141292 _idmap_list_mappings_1(idmap_list_mappings_1_argument *argp, 594520Snw141292 idmap_mappings_res *result, struct svc_req *rqstp) { 604520Snw141292 return (idmap_list_mappings_1_svc(argp->is_user, argp->lastrowid, 614520Snw141292 argp->limit, result, rqstp)); 624520Snw141292 } 634520Snw141292 644520Snw141292 int 654520Snw141292 _idmap_list_namerules_1(idmap_list_namerules_1_argument *argp, 664520Snw141292 idmap_namerules_res *result, struct svc_req *rqstp) { 674520Snw141292 return (idmap_list_namerules_1_svc(argp->rule, argp->lastrowid, 684520Snw141292 argp->limit, result, rqstp)); 694520Snw141292 } 704520Snw141292 714520Snw141292 int 72*5064Sdm199847 _idmap_update_1(idmap_update_batch *argp, idmap_update_res *res, 734520Snw141292 struct svc_req *rqstp) { 74*5064Sdm199847 return (idmap_update_1_svc(*argp, res, rqstp)); 754520Snw141292 } 764520Snw141292 774520Snw141292 int 784520Snw141292 _idmap_get_mapped_id_by_name_1(idmap_mapping *argp, 794520Snw141292 idmap_mappings_res *result, struct svc_req *rqstp) { 804520Snw141292 return (idmap_get_mapped_id_by_name_1_svc(*argp, result, rqstp)); 814520Snw141292 } 824520Snw141292 834520Snw141292 844520Snw141292 void 854520Snw141292 idmap_prog_1(struct svc_req *rqstp, register SVCXPRT *transp) 864520Snw141292 { 874520Snw141292 union { 884520Snw141292 idmap_mapping_batch idmap_get_mapped_ids_1_arg; 894520Snw141292 idmap_list_mappings_1_argument idmap_list_mappings_1_arg; 904520Snw141292 idmap_list_namerules_1_argument idmap_list_namerules_1_arg; 914520Snw141292 idmap_update_batch idmap_update_1_arg; 924520Snw141292 idmap_mapping idmap_get_mapped_id_by_name_1_arg; 934520Snw141292 } argument; 944520Snw141292 union { 954520Snw141292 idmap_ids_res idmap_get_mapped_ids_1_res; 964520Snw141292 idmap_mappings_res idmap_list_mappings_1_res; 974520Snw141292 idmap_namerules_res idmap_list_namerules_1_res; 98*5064Sdm199847 idmap_update_res idmap_update_1_res; 994520Snw141292 idmap_mappings_res idmap_get_mapped_id_by_name_1_res; 1004520Snw141292 } result; 1014520Snw141292 bool_t retval; 1024520Snw141292 xdrproc_t _xdr_argument, _xdr_result; 1034520Snw141292 bool_t (*local)(char *, void *, struct svc_req *); 1044520Snw141292 1054520Snw141292 (void) mutex_lock(&_svcstate_lock); 1064520Snw141292 _rpcsvccount++; 1074520Snw141292 (void) mutex_unlock(&_svcstate_lock); 1084520Snw141292 switch (rqstp->rq_proc) { 1094520Snw141292 case IDMAP_NULL: 1104520Snw141292 _xdr_argument = (xdrproc_t)xdr_void; 1114520Snw141292 _xdr_result = (xdrproc_t)xdr_void; 1124520Snw141292 local = (bool_t (*) (char *, void *, struct svc_req *)) 1134520Snw141292 _idmap_null_1; 1144520Snw141292 break; 1154520Snw141292 1164520Snw141292 case IDMAP_GET_MAPPED_IDS: 1174520Snw141292 _xdr_argument = (xdrproc_t)xdr_idmap_mapping_batch; 1184520Snw141292 _xdr_result = (xdrproc_t)xdr_idmap_ids_res; 1194520Snw141292 local = (bool_t (*) (char *, void *, struct svc_req *)) 1204520Snw141292 _idmap_get_mapped_ids_1; 1214520Snw141292 break; 1224520Snw141292 1234520Snw141292 case IDMAP_LIST_MAPPINGS: 1244520Snw141292 _xdr_argument = (xdrproc_t)xdr_idmap_list_mappings_1_argument; 1254520Snw141292 _xdr_result = (xdrproc_t)xdr_idmap_mappings_res; 1264520Snw141292 local = (bool_t (*) (char *, void *, struct svc_req *)) 1274520Snw141292 _idmap_list_mappings_1; 1284520Snw141292 break; 1294520Snw141292 1304520Snw141292 case IDMAP_LIST_NAMERULES: 1314520Snw141292 _xdr_argument = (xdrproc_t)xdr_idmap_list_namerules_1_argument; 1324520Snw141292 _xdr_result = (xdrproc_t)xdr_idmap_namerules_res; 1334520Snw141292 local = (bool_t (*) (char *, void *, struct svc_req *)) 1344520Snw141292 _idmap_list_namerules_1; 1354520Snw141292 break; 1364520Snw141292 1374520Snw141292 case IDMAP_UPDATE: 1384520Snw141292 _xdr_argument = (xdrproc_t)xdr_idmap_update_batch; 139*5064Sdm199847 _xdr_result = (xdrproc_t)xdr_idmap_update_res; 1404520Snw141292 local = (bool_t (*) (char *, void *, struct svc_req *)) 1414520Snw141292 _idmap_update_1; 1424520Snw141292 break; 1434520Snw141292 1444520Snw141292 case IDMAP_GET_MAPPED_ID_BY_NAME: 1454520Snw141292 _xdr_argument = (xdrproc_t)xdr_idmap_mapping; 1464520Snw141292 _xdr_result = (xdrproc_t)xdr_idmap_mappings_res; 1474520Snw141292 local = (bool_t (*) (char *, void *, struct svc_req *)) 1484520Snw141292 _idmap_get_mapped_id_by_name_1; 1494520Snw141292 break; 1504520Snw141292 1514520Snw141292 default: 1524520Snw141292 svcerr_noproc(transp); 1534520Snw141292 (void) mutex_lock(&_svcstate_lock); 1544520Snw141292 _rpcsvccount--; 1554520Snw141292 _rpcsvcstate = _SERVED; 1564520Snw141292 (void) mutex_unlock(&_svcstate_lock); 1574520Snw141292 return; 1584520Snw141292 } 1594520Snw141292 (void) memset((char *)&argument, 0, sizeof (argument)); 1604520Snw141292 if (!svc_getargs(transp, _xdr_argument, (caddr_t)&argument)) { 1614520Snw141292 svcerr_decode(transp); 1624520Snw141292 (void) mutex_lock(&_svcstate_lock); 1634520Snw141292 _rpcsvccount--; 1644520Snw141292 _rpcsvcstate = _SERVED; 1654520Snw141292 (void) mutex_unlock(&_svcstate_lock); 1664520Snw141292 return; 1674520Snw141292 } 1684520Snw141292 retval = (bool_t)(*local)((char *)&argument, (void *)&result, rqstp); 1694520Snw141292 if (_xdr_result && retval > 0 && !svc_sendreply(transp, _xdr_result, 1704520Snw141292 (char *)&result)) { 1714520Snw141292 svcerr_systemerr(transp); 1724520Snw141292 } 1734520Snw141292 if (!svc_freeargs(transp, _xdr_argument, (caddr_t)&argument)) { 1744520Snw141292 idmapdlog(LOG_ERR, 1754520Snw141292 "unable to free RPC arguments"); 1764520Snw141292 exit(1); 1774520Snw141292 } 1784520Snw141292 if (_xdr_result != NULL) { 1794520Snw141292 if (!idmap_prog_1_freeresult(transp, _xdr_result, 1804520Snw141292 (caddr_t)&result)) 1814520Snw141292 idmapdlog(LOG_ERR, 1824520Snw141292 "unable to free RPC results"); 1834520Snw141292 1844520Snw141292 } 1854520Snw141292 (void) mutex_lock(&_svcstate_lock); 1864520Snw141292 _rpcsvccount--; 1874520Snw141292 _rpcsvcstate = _SERVED; 1884520Snw141292 (void) mutex_unlock(&_svcstate_lock); 1894520Snw141292 } 190