"Fossies" - the Fresh Open Source Software Archive

Member "delegate9.9.13/subin/dgxauth.c" (26 Feb 2010, 1684 Bytes) of package /linux/misc/old/delegate9.9.13.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "dgxauth.c" see the Fossies "Dox" file reference documentation.

    1 /*////////////////////////////////////////////////////////////////////////
    2 Copyright (c) 2003 National Institute of Advanced Industrial Science and Technology (AIST)
    3 
    4 Permission to use this material for evaluation, copy this material for
    5 your own use, and distribute the copies via publically accessible on-line
    6 media, without fee, is hereby granted provided that the above copyright
    7 notice and this permission notice appear in all copies.
    8 AIST MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY OF THIS
    9 MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", WITHOUT ANY EXPRESS
   10 OR IMPLIED WARRANTIES.
   11 /////////////////////////////////////////////////////////////////////////
   12 Content-Type:   program/C; charset=US-ASCII
   13 Program:    dgxauth.c
   14 Author:     Yutaka Sato <ysato@delegate.org>
   15 Description:
   16     External commands under subin/ are executed under file owner's
   17     user-ID (root) and group-ID (Group).
   18     They must not be utilized by anyone (porcess) other than the
   19     owner (Group) of it.
   20     Therefore they are permitted to execute only if the real
   21     group-ID of the owner of the caller process equals to the Group
   22     which is set as the effective group-ID.
   23 History:
   24     030117  created
   25 //////////////////////////////////////////////////////////////////////#*/
   26 #include <stdlib.h>
   27 #include <stdio.h>
   28 #include <unistd.h>
   29 #include <sys/types.h>
   30 #include "ystring.h"
   31 int randstack_call(int strg, iFUNCP func, ...);
   32 
   33 static void dgxauth(int ac,char *av[])
   34 {   int gid,egid;
   35 
   36     gid = getgid();
   37     egid = getegid();
   38     if( getuid() <= 0 ){
   39         /* allow super-user to use subin/* */
   40     }else
   41     if( egid != gid ){
   42         fprintf(stderr,"ERROR: gid=%d egid=%d (uid=%d %d)\n",
   43             gid,egid,getuid(),geteuid());
   44         exit(-1);
   45     }
   46 }