Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_sys_main.c 


Log Message:


and actually match groups right!

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_sys_main.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_sys_main.c        28 Sep 2006 06:07:15 -0000      1.5
+++ e_sys_main.c        28 Sep 2006 06:35:43 -0000      1.6
@@ -17,7 +17,7 @@
 #include <Evas.h>
 
 /* local subsystem functions */
-static int auth_action_ok(char *a, uid_t uid, gid_t gid);
+static int auth_action_ok(char *a, uid_t uid, gid_t gid, gid_t *gl, int gn, 
gid_t egid);
 static int auth_etc_enlightenment_sysactions(char *a, char *u, char **g);
 static char *get_word(char *s, char *d);
 
@@ -28,11 +28,11 @@
 int
 main(int argc, char **argv)
 {
-   int i;
+   int i, gn;
    int test = 0;
    char *action, *cmd;
    uid_t uid;
-   gid_t gid;
+   gid_t gid, gl[1024], egid;
 
    for (i = 1; i < argc; i++)
      {
@@ -63,6 +63,8 @@
 
    uid = getuid();
    gid = getgid();
+   egid = getegid();
+   gn = getgroups(1024, gl);
    
    if (setuid(0) != 0)
      {
@@ -77,7 +79,7 @@
    
    evas_init();
 
-   if (!auth_action_ok(action, uid, gid))
+   if (!auth_action_ok(action, uid, gid, gl, gn, egid))
      {
        printf("ERROR: ACTION NOT ALLOWED: %s\n", action);
        exit(10);
@@ -99,20 +101,17 @@
 
 /* local subsystem functions */
 static int
-auth_action_ok(char *a, uid_t uid, gid_t gid)
+auth_action_ok(char *a, uid_t uid, gid_t gid, gid_t *gl, int gn, gid_t egid)
 {
    struct passwd *pw;
    struct group *gp;
-   char *usr = NULL, **grp;
-   int ret, gn, i, j;
-   gid_t gl[1024], egid;
+   char *usr = NULL, **grp, *g;
+   int ret, i, j;
 
    pw = getpwuid(uid);
    if (!pw) return 0;
    usr = pw->pw_name;
    if (!usr) return 0;
-   egid = getegid();
-   gn = getgroups(1024, gl);
    grp = alloca(sizeof(char *) * (gn + 1 + 1));
    j = 0;
    gp = getgrgid(gid);
@@ -128,7 +127,9 @@
             gp = getgrgid(gl[i]);
             if (gp)
               {
-                 grp[j] = gp->gr_name;
+                 g = alloca(strlen(gp->gr_name) + 1);
+                 strcpy(g, gp->gr_name);
+                 grp[j] = g;
                  j++;
               }
          }
@@ -210,7 +211,7 @@
                         goto malformed;
                    }
               }
-            if (matched) continue;
+            if (!matched) continue;
          }
        else if (!strcmp(id, "action:"))
          {



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to