dazuko-help
[Top][All Lists]
Advanced

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

Re: [Dazuko-help] Dazuko 3.x and finer gain events


From: Lino Sanfilippo
Subject: Re: [Dazuko-help] Dazuko 3.x and finer gain events
Date: Mon, 03 Aug 2009 13:06:40 +0200
User-agent: Icedove 1.5.0.14eol (X11/20090105)

Robert Minsk wrote:
I also just realized that I do not get the uid of the user with the new
dazukofs.  Are there any plans to add uid back in?


_______________________________________________
Dazuko-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/dazuko-help

Dazukofs is currently evolving. So chances are good that there will be other features /
informations available in future versions.
There is also a modified dazukofs version by our company (Avira) shipped with the avguard. This
mod is adapted to the needs of our anti-virus software.
Please check future avguard releases for the newest avira mods of dazukofs.
Meanwhile you have to use a workaround to determine the userid of a file accessing process. The following function can be used to find out a process' uid from the pid given by dazukofs:


/* this is a workaround since dazukofs does not provide the
* effective user id of the file accessing process (yet) */
static inline int getuid_from_pid(pid_t pid, uid_t *uid)
{
   const char UID_STR[] = "Uid:\t%u\t%u\t%u\t%u";
   const int LINE_LEN = 128;
   const int PROCPATH_LEN = 32;
   FILE *file;
   char procpath[LINE_LEN];
   char line[PROCPATH_LEN];
   char *l;
   int rv = -1;
   uid_t t1, t2, t3;



   snprintf(procpath, sizeof(procpath), "/proc/%u/status", pid);
   file = fopen(procpath, "r");
   if (!file)
       return -1;
while((l = fgets(line, sizeof(line), file)) != NULL) {
       if (!strncmp(l, UID_STR, 4)) {
           sscanf(l, UID_STR, uid, &t1, &t2, &t3);
           rv = 0;
           goto out;
} }
   if (errno)
      fprintf(stderr, "failed to get line from file %s: %s\n", procpath,
           strerror(errno));
out:
   fclose(file);

   return rv;
}


Greetings,
Lino

Geschäftsführender Gesellschafter: Tjark Auerbach
Sitz der Gesellschaft: Tettnang
Handelsregister: Amtsgericht Ulm, HRB 630992
ALLGEMEINE GESCHÄFTSBEDINGUNGEN
Es gelten unsere Allgemeinen Geschäftsbedingungen
(AGB). Sie finden sie in der jeweils gültigen Fassung
im Internet unter http://www.avira.de/agb
***************************************************




reply via email to

[Prev in Thread] Current Thread [Next in Thread]