home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / ixemul-45.0-src.tgz / tar.out / contrib / ixemul / ixnet / user.c < prev    next >
C/C++ Source or Header  |  1996-09-28  |  2KB  |  90 lines

  1. /*
  2.  *  This file is part of ixnet.library for the Amiga.
  3.  *  Copyright (C) 1996 Jeff Shepherd
  4.  *
  5.  *  This library is free software; you can redistribute it and/or
  6.  *  modify it under the terms of the GNU Library General Public
  7.  *  License as published by the Free Software Foundation; either
  8.  *  version 2 of the License, or (at your option) any later version.
  9.  *
  10.  *  This library is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  *  Library General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU Library General Public
  16.  *  License along with this library; if not, write to the Free
  17.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  *  $Id: $
  20.  *
  21.  *  $Log:$
  22.  *
  23.  */
  24.  
  25.  
  26. #define _KERNEL
  27. #include "ixnet.h"
  28. #include "kprintf.h"
  29. #include <string.h>
  30. #include <unistd.h>
  31. #include <stdlib.h>
  32.  
  33. int setuid(uid_t uid)
  34. {
  35.   struct ixnet *p = (struct ixnet *)u.u_ixnet;
  36.  
  37.   if (p->u_networkprotocol == IX_NETWORK_AMITCP)
  38.     return UG_setuid(uid);
  39.   return 0;
  40. }
  41.  
  42. int seteuid(uid_t uid)
  43. {
  44.   return setreuid(getuid(),uid);
  45. }
  46.  
  47. int setreuid(int ruid, int euid) 
  48. {
  49.   struct ixnet *p = (struct ixnet *)u.u_ixnet;
  50.  
  51.   if (p->u_networkprotocol == IX_NETWORK_AMITCP)
  52.     return UG_setreuid(ruid, euid);
  53.   return 0;
  54. }
  55.  
  56. uid_t
  57. getuid(void)
  58. {
  59.     register struct ixnet *p = (struct ixnet *)u.u_ixnet;
  60.     register int network_protocol = p->u_networkprotocol;
  61.     uid_t retval;
  62.  
  63.     switch(network_protocol) {
  64.     case IX_NETWORK_AMITCP:
  65.         retval = UG_getuid();
  66.     break;
  67.  
  68.     default: /* case IX_NETWORK_AS225: */
  69.         retval = SOCK_getuid();
  70.     break;
  71.     }
  72.     return retval;
  73. }
  74.  
  75. uid_t
  76. geteuid(void)
  77. {
  78.     register struct ixnet *p = (struct ixnet *)u.u_ixnet;
  79.     register int network_protocol = p->u_networkprotocol;
  80.  
  81.     switch(network_protocol) {
  82.     case IX_NETWORK_AMITCP:
  83.         return UG_geteuid();
  84.  
  85.     default: /* case IX_NETWORK_AS225: */
  86.         return SOCK_getuid();
  87.     }
  88. }
  89.  
  90.