1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the
| 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the
|
5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License.
| 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License.
|
8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22/*
| 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/*
|
23 * Copyright (c) 1995,1997, by Sun Microsystems, Inc. 24 * All rights reserved.
| 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms.
|
25 */ 26 27#pragma ident "%Z%%M% %I% %E% SMI" 28 29/* 30 * Routines to set gssd value of uid and replace getuid libsys call. 31 */ 32 33#include <sys/types.h> 34#include <unistd.h> 35#include <stdio.h> 36#include <stdlib.h> 37#include <libintl.h> 38
| 24 */ 25 26#pragma ident "%Z%%M% %I% %E% SMI" 27 28/* 29 * Routines to set gssd value of uid and replace getuid libsys call. 30 */ 31 32#include <sys/types.h> 33#include <unistd.h> 34#include <stdio.h> 35#include <stdlib.h> 36#include <libintl.h> 37
|
39uid_t gssd_uid;
| 38static uid_t krb5_cc_uid;
|
40 41void
| 39 40void
|
42set_gssd_uid(uid) 43 uid_t uid;
| 41set_gssd_uid(uid_t uid)
|
44{
| 42{
|
45
| |
46 /*
| 43 /*
|
47 * set the value of gssd_uid, so it can be retrieved when getuid() 48 * is called by the underlying mechanism libraries
| 44 * set the value of krb5_cc_uid, so it can be retrieved when 45 * app_krb5_user_uid() is called by the underlying mechanism libraries.
|
49 */ 50 printf(gettext("set_gssd_uid called with uid = %d\n"), uid);
| 46 */ 47 printf(gettext("set_gssd_uid called with uid = %d\n"), uid);
|
51 gssd_uid = uid;
| 48 krb5_cc_uid = uid;
|
52} 53 54uid_t
| 49} 50 51uid_t
|
55getuid(void) 56
| 52app_krb5_user_uid(void)
|
57{
| 53{
|
58
| |
59 /* 60 * return the value set when one of the gssd procedures was 61 * entered. This is the value of the uid under which the 62 * underlying mechanism library must operate in order to 63 * get the user's credentials. This call is necessary since 64 * gssd runs as root and credentials are many times stored 65 * in files and directories specific to the user 66 */ 67 printf(gettext(
| 54 /* 55 * return the value set when one of the gssd procedures was 56 * entered. This is the value of the uid under which the 57 * underlying mechanism library must operate in order to 58 * get the user's credentials. This call is necessary since 59 * gssd runs as root and credentials are many times stored 60 * in files and directories specific to the user 61 */ 62 printf(gettext(
|
68 "getuid called and returning gsssd_uid = %d\n"), gssd_uid); 69 return (gssd_uid);
| 63 "getuid called and returning gsssd_uid = %d\n"), krb5_cc_uid); 64 return (krb5_cc_uid);
|
70}
| 65}
|