Diff for /suX/src/sux.c between versions 1.3.2.1 and 1.3.2.2

version 1.3.2.1, 2013/04/09 08:17:40 version 1.3.2.2, 2013/04/09 08:29:20
Line 50  initProg() Line 50  initProg()
 {  {
         char d[MAXPATHLEN];          char d[MAXPATHLEN];
   
        proc.proc_uid = getuid();        AIT_SET_I16(&proc.proc_uid, getuid());
        proc.proc_gid = getgid();        AIT_SET_I16(&proc.proc_gid, getgid());
        proc.proc_prio = getpriority(PRIO_PROCESS, 0);        AIT_SET_I32(&proc.proc_prio, getpriority(PRIO_PROCESS, 0));
         getcwd(d, sizeof d);          getcwd(d, sizeof d);
         AIT_SET_STR(&proc.proc_dir, d);          AIT_SET_STR(&proc.proc_dir, d);
   
Line 93  setUIDGID(char flg, const char *name) Line 93  setUIDGID(char flg, const char *name)
         }          }
   
         if (!(flg & 1))          if (!(flg & 1))
                proc.proc_uid = sb.st_uid;                AIT_SET_I16(&proc.proc_uid, sb.st_uid);
         if (!(flg & 2))          if (!(flg & 2))
                proc.proc_gid = sb.st_gid;                AIT_SET_I16(&proc.proc_gid, sb.st_gid);
   
         return 0;          return 0;
 }  }
Line 106  SetClass() Line 106  SetClass()
         login_cap_t *cap;          login_cap_t *cap;
         struct passwd *pass;          struct passwd *pass;
   
        pass = getpwuid(proc.proc_uid);        pass = getpwuid(AIT_GET_I16(&proc.proc_uid));
         if (!pass) {          if (!pass) {
                 Err("Error:: User with this UID %d not found", proc.proc_uid);                  Err("Error:: User with this UID %d not found", proc.proc_uid);
                 endpwent();                  endpwent();
Line 121  SetClass() Line 121  SetClass()
                 return -1;                  return -1;
         }          }
   
        if (setusercontext(cap, pass, proc.proc_uid, LOGIN_SETALL)) {        if (setusercontext(cap, pass, AIT_GET_I16(&proc.proc_uid), LOGIN_SETALL)) {
                 Err("Error:: Cant set login class %s", AIT_GET_STR(&proc.proc_class));                  Err("Error:: Cant set login class %s", AIT_GET_STR(&proc.proc_class));
                 login_close(cap);                  login_close(cap);
                 endpwent();                  endpwent();
Line 167  LoadCfgData(char flg) Line 167  LoadCfgData(char flg)
         if (!(flg & 4)) {          if (!(flg & 4)) {
                 str = cfg_getAttribute(&cfg, "global", "priority");                  str = cfg_getAttribute(&cfg, "global", "priority");
                 if (str)                  if (str)
                        proc.proc_prio = strtol(str, NULL, 10);                        AIT_SET_I32(&proc.proc_prio, strtol(str, NULL, 10));
         }          }
   
         /* find associate extension */          /* find associate extension */
Line 302  main(int argc, char **argv) Line 302  main(int argc, char **argv)
                                 flg |= 8;                                  flg |= 8;
                                 break;                                  break;
                         case 'p':                          case 'p':
                                proc.proc_prio = strtol(optarg, NULL, 0);                                AIT_SET_I32(&proc.proc_prio, strtol(optarg, NULL, 0));
                                 flg |= 4;                                  flg |= 4;
                                 break;                                  break;
                         case 'g':                          case 'g':
                                 setgrent();                                  setgrent();
                                 grp = getgrnam(optarg);                                  grp = getgrnam(optarg);
                                 if (grp) {                                  if (grp) {
                                        proc.proc_gid = grp->gr_gid;                                        AIT_SET_I16(&proc.proc_gid, grp->gr_gid);
                                         flg |= 2;                                          flg |= 2;
                                 } else                                  } else
                                         Err("Error:: Group not found!");                                          Err("Error:: Group not found!");
Line 319  main(int argc, char **argv) Line 319  main(int argc, char **argv)
                                 setpwent();                                  setpwent();
                                 pass = getpwnam(optarg);                                  pass = getpwnam(optarg);
                                 if (pass) {                                  if (pass) {
                                        proc.proc_uid = pass->pw_uid;                                        AIT_SET_I16(&proc.proc_uid, pass->pw_uid);
                                         flg |= 1;                                          flg |= 1;
                                 } else                                  } else
                                         Err("Error:: User not found!");                                          Err("Error:: User not found!");

Removed from v.1.3.2.1  
changed lines
  Added in v.1.3.2.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>