[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bugs in mintlib. Needed to get SMAIL to work (Posted for Mats Loman)



This is posted for Mats Loman, all replys should be sent to: 
	lom@tc.multi.se 

Sorry for the misstake not sending this earlier! This FIX must be done to 
get Mats port of SMAIL (diffs sen't out last week :^) to work! 

//Robert - Very sorry about forgetting about this mail ;^(

d93rkr@t.hfb.se   (Robert Krenn)     _/_/_/ _/_/_/ _/_/_/ _/_/   _/ LYNX
University of Borlange, Sweden      _/  _/   _/   _/  _/ _/  _/ _/ STm
tel: +46-243224839                 _/_/_/   _/   _/_/_/ _/_/   _/ STe
http://tpx5.hfb.se:8000/~d93rkr   _/  _/   _/   _/  _/ _/  _/ _/ F-030


------------------------8<---------------------------------------

I found some bugs in mintlib pl44/45.

seteuid and setegid did not work correctly. The called setuid/setgid 
instead of doing something useful :-(  That broke my smail and probably
other utilities too. 

I think it's time to do something about the mintlibrary.
setauid()/getauid() is missing and some support for the complementary
groups. Is it really necesary to support multiple versions of the mint kernel?
Otherwise we could do things like:

#include <mintbind.h>  /* Needs to be updated allso... */
static __inline__ setuid(uid_t u) { Psetuid((short)u); }

In the library startup we could have something that checked the MiNT
version (whith the MiNT cookie reader) and tells the user that he have
an old version of mint if version< 1.12 or similar..

In the future i would like to include the file mintbind.h in the mh-mint
distribution so that it could be updated when apply a patch to mh-mint.

Here are new ones:


seteuid.c:

#include <types.h>
#include <unistd.h>
#include <osbind.h>
#include <mintbind.h>
#include <errno.h>

extern int __mint;
extern uid_t __euid;

int
seteuid(x)
  int x;
{
  long r;

  if (__mint) {
    r = Pseteuid(x);
    if (r < 0) {
      errno = (int) -r;
      return -1;
    }
    return 0;
  }
  __euid = x;
  return 0;
}




setegid.c:

#include <types.h>
#include <unistd.h>
#include <osbind.h>
#include <mintbind.h>
#include <errno.h>

extern int __mint;
extern gid_t __egid;

int
setegid(x)
  int x;
{
  long r;

  if (__mint) {
    r = Psetegid(x);
    if (r < 0) {
      errno = (int) -r;
      return -1;
    }
    return 0;
  }
  __egid = x;
  return 0;
}




geteuid.c:

#include <types.h>
#include <unistd.h>
#include <mintbind.h>

extern int __mint;
extern uid_t __euid;

uid_t
geteuid()
{
  return __mint >= 95 ? Pgeteuid() : __euid;
}




getegid.c:

#include <types.h>
#include <unistd.h>
#include <mintbind.h>

extern int __mint;
extern gid_t __egid;

gid_t
getegid()
{
  return __mint >= 95 ? Pgetegid() : __egid;
}




uidgid.c:

#include <types.h>

uid_t __uid = 0, __euid = 0;
gid_t __gid = 0, __egid = 0;



----------------------------
Mats Loman <lom@tc.mult.se>
----------------------------