17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 567dbe2beSCasper H.S. Dik * Common Development and Distribution License (the "License"). 667dbe2beSCasper H.S. Dik * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21a05fd0c9SMarcel Telka 22a05fd0c9SMarcel Telka /* 23a05fd0c9SMarcel Telka * Copyright 2014 Nexenta Systems, Inc. All rights reserved. 244b3b7fc6SAlex Wilson * Copyright 2017 Joyent Inc 25a05fd0c9SMarcel Telka */ 26a05fd0c9SMarcel Telka 277c478bd9Sstevel@tonic-gate /* 2867dbe2beSCasper H.S. Dik * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 297c478bd9Sstevel@tonic-gate * Use is subject to license terms. 307c478bd9Sstevel@tonic-gate */ 317c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 327c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Portions of this source code were derived from Berkeley 357c478bd9Sstevel@tonic-gate * 4.3 BSD under license from the Regents of the University of 367c478bd9Sstevel@tonic-gate * California. 377c478bd9Sstevel@tonic-gate */ 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate /* 407c478bd9Sstevel@tonic-gate * auth_sys.h, Protocol for UNIX style authentication parameters for RPC 417c478bd9Sstevel@tonic-gate */ 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #ifndef _RPC_AUTH_SYS_H 447c478bd9Sstevel@tonic-gate #define _RPC_AUTH_SYS_H 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate /* 477c478bd9Sstevel@tonic-gate * The system is very weak. The client uses no encryption for it 487c478bd9Sstevel@tonic-gate * credentials and only sends null verifiers. The server sends backs 497c478bd9Sstevel@tonic-gate * null verifiers or optionally a verifier that suggests a new short hand 507c478bd9Sstevel@tonic-gate * for the credentials. 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #include <sys/types.h> 5467dbe2beSCasper H.S. Dik #include <sys/param.h> 557c478bd9Sstevel@tonic-gate #include <rpc/types.h> 567c478bd9Sstevel@tonic-gate #include <rpc/xdr.h> 577c478bd9Sstevel@tonic-gate #include <rpc/auth.h> 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate #ifdef __cplusplus 607c478bd9Sstevel@tonic-gate extern "C" { 617c478bd9Sstevel@tonic-gate #endif 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* The machine name is part of a credential; it may not exceed 255 bytes */ 647c478bd9Sstevel@tonic-gate #define MAX_MACHINE_NAME 255 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* gids compose part of a credential; there may not be more than 16 of them */ 677c478bd9Sstevel@tonic-gate #define NGRPS 16 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * "sys" (Old UNIX) style credentials. 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate struct authsys_parms { 737c478bd9Sstevel@tonic-gate uint_t aup_time; 747c478bd9Sstevel@tonic-gate char *aup_machname; 757c478bd9Sstevel@tonic-gate uid_t aup_uid; 767c478bd9Sstevel@tonic-gate gid_t aup_gid; 777c478bd9Sstevel@tonic-gate uint_t aup_len; 787c478bd9Sstevel@tonic-gate gid_t *aup_gids; 797c478bd9Sstevel@tonic-gate }; 807c478bd9Sstevel@tonic-gate /* For backward compatibility */ 817c478bd9Sstevel@tonic-gate #define authunix_parms authsys_parms 827c478bd9Sstevel@tonic-gate 834b3b7fc6SAlex Wilson /* 844b3b7fc6SAlex Wilson * Ideally, we would like this to be NGROUPS_UMAX, but the RFC mandates that 854b3b7fc6SAlex Wilson * auth sections must not exceed 400 bytes. For AUTH_LOOPBACK, that means the 864b3b7fc6SAlex Wilson * largest number of groups we can have without breaking RFC compat is 92 874b3b7fc6SAlex Wilson * groups. 884b3b7fc6SAlex Wilson * 894b3b7fc6SAlex Wilson * NOTE: changing this value changes the size of authlpbk_area in 904b3b7fc6SAlex Wilson * svc_auth_loopb.c, which means RQCRED_SIZE *must* be updated! 914b3b7fc6SAlex Wilson */ 924b3b7fc6SAlex Wilson #define NGRPS_LOOPBACK 92 934b3b7fc6SAlex Wilson 947c478bd9Sstevel@tonic-gate #ifdef __STDC__ 957c478bd9Sstevel@tonic-gate extern bool_t xdr_authsys_parms(XDR *, struct authsys_parms *); 967c478bd9Sstevel@tonic-gate #else 977c478bd9Sstevel@tonic-gate extern bool_t xdr_authsys_parms(); 987c478bd9Sstevel@tonic-gate #endif 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate /* For backward compatibility */ 1027c478bd9Sstevel@tonic-gate #define xdr_authunix_parms(xdrs, p) xdr_authsys_parms(xdrs, p) 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate /* 1057c478bd9Sstevel@tonic-gate * If a response verifier has flavor AUTH_SHORT, then the body of 1067c478bd9Sstevel@tonic-gate * the response verifier encapsulates the following structure; 1077c478bd9Sstevel@tonic-gate * again it is serialized in the obvious fashion. 1087c478bd9Sstevel@tonic-gate */ 1097c478bd9Sstevel@tonic-gate struct short_hand_verf { 1107c478bd9Sstevel@tonic-gate struct opaque_auth new_cred; 1117c478bd9Sstevel@tonic-gate }; 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate struct svc_req; 1147c478bd9Sstevel@tonic-gate 115a05fd0c9SMarcel Telka extern bool_t xdr_gid_t(XDR *, gid_t *); 116a05fd0c9SMarcel Telka extern bool_t xdr_uid_t(XDR *, uid_t *); 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate #ifdef _KERNEL 119*0e91b739SMarcel Telka extern bool_t xdr_authkern(XDR *, cred_t *); 120*0e91b739SMarcel Telka extern bool_t xdr_authloopback(XDR *, cred_t *); 1217c478bd9Sstevel@tonic-gate extern enum auth_stat _svcauth_unix(struct svc_req *, struct rpc_msg *); 1227c478bd9Sstevel@tonic-gate extern enum auth_stat _svcauth_short(struct svc_req *, struct rpc_msg *); 1237c478bd9Sstevel@tonic-gate #endif 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1267c478bd9Sstevel@tonic-gate } 1277c478bd9Sstevel@tonic-gate #endif 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate #endif /* !_RPC_AUTH_SYS_H */ 130