]> git.pld-linux.org Git - packages/chkconfig.git/blobdiff - chkconfig-noxinet.patch
- updated to 1.25
[packages/chkconfig.git] / chkconfig-noxinet.patch
index aff66c726f495f56c247a4e0ba23a1eaf4247721..9be6af2bf7d0f2b28fc02015bf9f81dde855a35f 100644 (file)
-diff -Nru chkconfig-1.2.22/chkconfig.c chkconfig-1.2.22.new/chkconfig.c
---- chkconfig-1.2.22/chkconfig.c       Sun Mar 25 03:29:32 2001
-+++ chkconfig-1.2.22.new/chkconfig.c   Sun Mar 25 03:31:17 2001
-@@ -51,7 +51,6 @@
-       readServiceError(rc, name);
-       return 1;
+diff -urNpa chkconfig-1.15.orig/chkconfig.8 chkconfig-1.15/chkconfig.8
+--- chkconfig-1.15.orig/chkconfig.8    2021-01-21 09:19:06.000000000 +0100
++++ chkconfig-1.15/chkconfig.8 2021-05-03 16:45:40.506185842 +0200
+@@ -63,16 +63,6 @@ or a stop script.  When switching runlev
+ an already-started service, and will not re-stop a service that is
+ not running.
+-\fBchkconfig\fR also can manage xinetd scripts via the means
+-of xinetd.d configuration files. Note that only the
+-\fBon\fR, \fBoff\fR, and \fB-\-list\fR commands are supported
+-for xinetd.d services.
+-
+-\fBchkconfig\fR supports a \fB-\-type\fR argument to limit actions to only
+-a specific type of services, in the case where services of either type may
+-share a name. Possible values for \fItype\fR are \fIsysv\fR
+-and \fIxinetd\fR.
+-
+ .SH OPTIONS
+ .TP
+ \fB-\-level \fIlevels\fR
+--- chkconfig-1.25/chkconfig.c.orig    2023-10-07 20:29:44.542142680 +0200
++++ chkconfig-1.25/chkconfig.c 2023-10-07 20:30:56.375086861 +0200
+@@ -117,8 +117,6 @@ static int delService(char *name, int ty
+         readServiceError(rc, name);
+         return 1;
      }
--    if (s.type == TYPE_XINETD) return 0;
+-    if (s.type == TYPE_XINETD)
+-        return 0;
  
-     for (level = 0; level < 7; level++) {
-           if (!findServiceEntries(name, level, &globres)) {
-@@ -72,8 +71,6 @@
-       return 1;
+     checkRoot();
+@@ -333,8 +331,6 @@ static int addService(char *name, int ty
+         return 1;
      }
-       
--    if (s.type == TYPE_XINETD) return 0;
--    
-     for (i = 0; i < 7; i++) {
-           if ((1 << i) & s.levels)
-               doSetService(s, i, 1);
-@@ -96,10 +93,6 @@
+-    if (s.type == TYPE_XINETD)
+-        return 0;
+     checkRoot();
+     if (s.isLSB) {
+@@ -373,9 +369,6 @@ static int overrideService(char *name, i
+         return 0;
+     }
+-    if (s.type == TYPE_XINETD)
+-        return 0;
+-
+     checkRoot();
+     if ((s.levels == o.levels) && (s.kPriority == o.kPriority) &&
+@@ -452,10 +445,6 @@ static int showServiceInfo(struct servic
      }
  
      printf("%-15s", s.name);
 -    if (s.type == TYPE_XINETD) {
--          printf("\t%s\n", s.levels ? _("on") : _("off"));
--          return 0;
+-        printf("\t%s\n", s.levels ? _("on") : _("off"));
+-        return 0;
 -    }
  
      for (i = 0; i < 7; i++) {
-       printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off"));
-@@ -109,21 +102,6 @@
-     return 0;
+         printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off"));
+@@ -469,8 +458,7 @@ static int showServiceInfoByName(char *n
+     int rc;
+     struct service s;
+-    if (systemdActive() && isOverriddenBySystemd(name) &&
+-        !(type & TYPE_XINETD)) {
++    if (systemdActive() && isOverriddenBySystemd(name)) {
+         return forgiving ? 0 : 1;
+     }
+@@ -485,20 +473,6 @@ static int showServiceInfoByName(char *n
+     return showServiceInfo(s, forgiving);
  }
  
 -static int isXinetdEnabled() {
--      int i;
--      struct service s;
--      
--      if (readServiceInfo("xinetd", &s, 0)) {
--              return 0;
--      }
--      for (i = 0; i < 7; i++) {
--              if (isOn("xinetd", i))
--                return 1;
--      }
--      return 0;
+-    struct service s;
+-
+-    if (isOverriddenBySystemd("xinetd") && isEnabledInSystemd("xinetd"))
+-        return 1;
+-
+-    if (readServiceInfo("xinetd", TYPE_INIT_D, &s, 0)) {
+-        return 0;
+-    }
+-    if (s.currentLevels)
+-        return 1;
+-    return 0;
 -}
--      
 -
- static int listService(char * item) {
-     DIR * dir;
-     struct dirent * ent;
-@@ -174,35 +152,6 @@
+ static int serviceNameCmp(const void *a, const void *b) {
+     const struct service *first = a;
+     const struct service *second = b;
+@@ -534,56 +508,6 @@ static int listService(char *item, int t
+             }
+         }
      }
-     closedir(dir);
--      
--    if (isXinetdEnabled()) {
--          printf(_("xinetd based services:\n"));
--          if (!(dir = opendir(XINETDDIR))) {
--                  fprintf(stderr, _("failed to open directory %s: %s"),
--                          XINETDDIR, strerror(err));
--                  return 1;
--          }
--          while ((ent = readdir(dir))) {
--                  const char *dn;
--                  struct service s;
 -
--                  /* Skip any file starting with a . */
--                  if (ent->d_name[0] == '.')  continue;
+-    if (isXinetdEnabled() && type & TYPE_XINETD) {
+-        struct service *s, *t;
+-
+-        printf("\n");
+-        printf(_("xinetd based services:\n"));
+-        if (!(dir = opendir(XINETDDIR))) {
+-            fprintf(stderr, _("failed to open directory %s: %s\n"), XINETDDIR,
+-                    strerror(err));
+-            return 1;
+-        }
+-        numServices = 0;
+-        numServicesAlloced = 10;
+-        s = malloc(sizeof(*s) * numServicesAlloced);
+-
+-        while ((ent = readdir(dir))) {
+-            const char *dn;
+-
+-            /* Skip any file starting with a . */
+-            if (ent->d_name[0] == '.')
+-                continue;
 -
--                  /* Skip files with known bad extensions */
--                  if ((dn = strrchr(ent->d_name, '.')) != NULL &&
--                      (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmnew") || !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp")))
--                    continue;
+-            /* Skip files with known bad extensions */
+-            if ((dn = strrchr(ent->d_name, '.')) != NULL &&
+-                (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmnew") ||
+-                 !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp")))
+-                continue;
 -
--                  dn = ent->d_name + strlen(ent->d_name) - 1;
--                  if (*dn == '~' || *dn == ',')
--                    continue;
--          
--                  readXinetdServiceInfo(ent->d_name, &s, 0);
--                  printf("\t%s:\t%s\n", s.name, s.levels ? _("on") : _("off"));
--          }
--          closedir(dir);
+-            dn = ent->d_name + strlen(ent->d_name) - 1;
+-            if (*dn == '~' || *dn == ',')
+-                continue;
+-
+-            if (numServices == numServicesAlloced) {
+-                numServicesAlloced += 10;
+-                s = realloc(s, numServicesAlloced * sizeof(*s));
+-            }
+-            if (readXinetdServiceInfo(ent->d_name, s + numServices) != -1)
+-                numServices++;
+-        }
+-
+-        qsort(s, numServices, sizeof(*s), serviceNameCmp);
+-        t = s;
+-        for (i = 0; i < numServices; i++, s++) {
+-            char *tmp = malloc(strlen(s->name) + 5);
+-            sprintf(tmp, "%s:", s->name);
+-            printf("\t%-15s\t%s\n", tmp, s->levels ? _("on") : _("off"));
+-        }
+-        closedir(dir);
+-        free(t);
 -    }
      return 0;
  }
  
-@@ -224,21 +173,16 @@
-       return 1;
-     }
+@@ -646,11 +570,6 @@ int setService(char *name, int type, int
+         reloadSystemd();
  
--    if (s.type == TYPE_INIT_D) {
--          for (i = 0; i < 7; i++) {
--                  if (!((1 << i) & where)) continue;
--
--                  if (state == 1 || state == 0)
--                    what = state;
--                  else if (s.levels & (1 << i))
--                    what = 1;
--                  else
--                    what = 0;
--                  doSetService(s, i, what);
--          }
+         return rc;
 -    } else if (s.type == TYPE_XINETD) {
--          setXinetdService(s, state);
--          system("/etc/init.d/xinetd reload >/dev/null 2>&1");
-+    for (i = 0; i < 7; i++) {
-+          if (!((1 << i) & where)) continue;
-+
-+          if (state == 1 || state == 0)
-+            what = state;
-+          else if (s.levels & (1 << i))
-+            what = 1;
-+          else
-+            what = 0;
-+          doSetService(s, i, what);
+-        if (setXinetdService(s, state)) {
+-            return 1;
+-        }
+-        system("/sbin/service xinetd reload >/dev/null 2>&1");
      }
  
      return 0;
-diff -Nru chkconfig-1.2.22/leveldb.c chkconfig-1.2.22.new/leveldb.c
---- chkconfig-1.2.22/leveldb.c Sun Mar 25 03:29:32 2001
-+++ chkconfig-1.2.22.new/leveldb.c     Sun Mar 25 03:31:47 2001
-@@ -138,88 +138,6 @@
-       return 0;
+@@ -658,8 +577,6 @@ int setService(char *name, int type, int
+ void forwardSystemd(const char *name, int type, const char *verb) {
+     int socket = 0;
+-    if (type == TYPE_XINETD)
+-        return;
+     if (!systemdIsInit())
+         return;
+@@ -743,12 +660,10 @@ int main(int argc, const char **argv) {
+         usage(progname);
+     if (typeString) {
+-        if (!strcmp(typeString, "xinetd"))
+-            type = TYPE_XINETD;
+-        else if (!strcmp(typeString, "sysv"))
++        if (!strcmp(typeString, "sysv"))
+             type = TYPE_INIT_D;
+         else {
+-            fprintf(stderr, _("--type must be 'sysv' or 'xinetd'\n"));
++            fprintf(stderr, _("--type must be 'sysv'\n"));
+             exit(1);
+         }
+     }
+@@ -873,16 +788,9 @@ int main(int argc, const char **argv) {
+             rc = readServiceInfo(name, type, &s, 0);
+             if (rc)
+                 return 1;
+-            if (s.type == TYPE_XINETD) {
+-                if (isXinetdEnabled())
+-                    return !s.levels;
+-                else
+-                    return 1;
+-            } else {
+                 if (level == -1)
+                     level = currentRunlevel();
+                 return s.currentLevels & (1 << level) ? 0 : 1;
+-            }
+         } else if (!strcmp(state, "on")) {
+             if (!noRedirectItem) {
+                 forwardSystemd(name, type, "enable");
+diff -urNpa chkconfig-1.15.orig/leveldb.c chkconfig-1.15/leveldb.c
+--- chkconfig-1.15.orig/leveldb.c      2021-05-03 16:40:14.588185842 +0200
++++ chkconfig-1.15/leveldb.c   2021-05-03 17:50:29.728139905 +0200
+@@ -204,114 +204,6 @@ int readDescription(char *start, char *b
+     return 0;
  }
  
--int readXinetdServiceInfo(char *name, struct service * service, int honorHide) {
--      char * filename = alloca(strlen(name) + strlen(XINETDDIR) + 50);
--      int fd;
--      struct service serv = { NULL, -1, -1, -1, NULL, 1, -1 };
--      struct stat sb;
--      char * buf, *ptr;
--      char * eng_desc = NULL, *start;
--      
--      snprintf(filename, strlen(name)+strlen(XINETDDIR)+50, XINETDDIR "/%s", name);
--      
--      if ((fd = open(filename, O_RDONLY)) < 0) return -1;
--      fstat(fd,&sb);
--      buf = malloc(sb.st_size+1);
--      if (read(fd,buf,sb.st_size)!=sb.st_size) {
--              close(fd);
--              free(buf);
--              return -1;
--      }
--      close(fd);
--        serv.name = strdup(name);
--      buf[sb.st_size] = '\0';
--      start = buf;
--      while (buf) {
--              ptr = strchr(buf,'\n');
--              if (*buf == '#') {
--                      buf++;
--                      while (isspace(*buf) && buf < ptr) buf++;
--                      if (!strncmp(buf,"default:", 9)) {
--                              buf+=8;
--                              while(isspace(*buf)) buf++;
--                              if (!strncmp(buf+9,"on",2)) {
--                                      serv.enabled = 1;
--                              } else {
--                                      serv.enabled = 0;
--                              }
--                      } else if (!strncmp(buf,"description:",12)) {
--                              buf+=11;
--                              if (readDescription(buf,start+sb.st_size,
--                                                  &serv.desc,&eng_desc)) {
--                                      if (serv.desc) free(serv.desc);
--                              }
--                              if (!serv.desc) {
--                                      if (eng_desc)
--                                        serv.desc = eng_desc;
--                              } else if (eng_desc)
--                                        free (eng_desc);
--                      }
--                      if (ptr) {
--                              *ptr = '\0';
--                              ptr++;
--                      } 
--                      buf = ptr;
--                      continue;
--              }
--              while (isspace(*buf) && buf < ptr) buf++;
--              if (!strncmp(buf,"disable", 7)) {
--                      buf = strstr(buf,"=");
--                      if (buf) 
--                        do {
--                                buf++;
--                        } while(isspace(*buf));
+-int readXinetdServiceInfo(char *name, struct service *service) {
+-    char *filename;
+-    int fd;
+-    struct service serv = {
+-        name : NULL,
+-        levels : -1,
+-        kPriority : 100,
+-        sPriority : -1,
+-        desc : NULL,
+-        startDeps : NULL,
+-        stopDeps : NULL,
+-        softStartDeps : NULL,
+-        softStopDeps : NULL,
+-        provides : NULL,
+-        type : TYPE_XINETD,
+-        isLSB : 0,
+-        enabled : -1
+-    };
+-    struct stat sb;
+-    char *buf = NULL, *ptr;
+-    char *eng_desc = NULL, *start;
+-
+-    asprintf(&filename, XINETDDIR "/%s", name);
 -
--                      if (buf && strncmp(buf,"yes",3)) {
--                              serv.levels = parseLevels("0123456",0);
--                              if (serv.enabled == -1)
--                                serv.enabled = 1;
--                      } else {
--                              serv.levels = 0;
--                              if (serv.enabled == -1)
--                                serv.enabled = 0;
--                      }
--              }
--              if (ptr) {
--                      *ptr = '\0';
--                      ptr++;
--              } 
--              buf = ptr;
--      }
--      *service = serv;
--      return 0;
+-    if ((fd = open(filename, O_RDONLY)) < 0)
+-        goto out_err;
+-    fstat(fd, &sb);
+-    if (!S_ISREG(sb.st_mode))
+-        goto out_err;
+-    buf = malloc(sb.st_size + 1);
+-    if (read(fd, buf, sb.st_size) != sb.st_size)
+-        goto out_err;
+-    close(fd);
+-    serv.name = strdup(name);
+-    buf[sb.st_size] = '\0';
+-    start = buf;
+-    while (buf) {
+-        ptr = strchr(buf, '\n');
+-        if (*buf == '#') {
+-            buf++;
+-            while (isspace(*buf) && buf < ptr)
+-                buf++;
+-            if (!strncmp(buf, "default:", 9)) {
+-                buf += 8;
+-                while (isspace(*buf))
+-                    buf++;
+-                if (!strncmp(buf + 9, "on", 2)) {
+-                    serv.enabled = 1;
+-                } else {
+-                    serv.enabled = 0;
+-                }
+-            } else if (!strncmp(buf, "description:", 12)) {
+-                buf += 11;
+-                if (readDescription(buf, start + sb.st_size, &serv.desc,
+-                                    &eng_desc)) {
+-                    if (serv.desc)
+-                        free(serv.desc);
+-                }
+-                if (!serv.desc) {
+-                    if (eng_desc)
+-                        serv.desc = eng_desc;
+-                    else
+-                        serv.desc = strdup(name);
+-                } else if (eng_desc)
+-                    free(eng_desc);
+-            }
+-            if (ptr) {
+-                *ptr = '\0';
+-                ptr++;
+-            }
+-            buf = ptr;
+-            continue;
+-        }
+-        while (isspace(*buf) && buf < ptr)
+-            buf++;
+-        if (!strncmp(buf, "disable", 7)) {
+-            buf = strstr(buf, "=");
+-            if (buf)
+-                do {
+-                    buf++;
+-                } while (isspace(*buf));
+-
+-            if (buf && strncmp(buf, "yes", 3)) {
+-                serv.levels = parseLevels("0123456", 0);
+-                if (serv.enabled == -1)
+-                    serv.enabled = 1;
+-            } else {
+-                serv.levels = 0;
+-                if (serv.enabled == -1)
+-                    serv.enabled = 0;
+-            }
+-        }
+-        if (ptr) {
+-            *ptr = '\0';
+-            ptr++;
+-        }
+-        buf = ptr;
+-    }
+-    *service = serv;
+-    return 0;
+-out_err:
+-    if (fd >= 0)
+-        close(fd);
+-    free(buf);
+-    free(filename);
+-    return -1;
 -}
 -
- int readServiceInfo(char * name, struct service * service, int honorHide) {
-     char * filename = alloca(strlen(name) + strlen(RUNLEVELS) + 50);
-     int fd;
-@@ -236,7 +154,7 @@
-     sprintf(filename, RUNLEVELS "/init.d/%s", name);
+ int readServices(struct service **services) {
+     DIR *dir;
+     struct dirent *ent;
+@@ -365,12 +257,12 @@ int readServiceInfo(char *name, int type
+     int parseret;
+     if (!(type & TYPE_INIT_D))
+-        goto try_xinetd;
++        return -1;
+     asprintf(&filename, RUNLEVELS "/init.d/%s", name);
+     if ((fd = open(filename, O_RDONLY)) < 0)
+-        goto try_xinetd;
++        return -1;
+     free(filename);
+     parseret = parseServiceInfo(fd, name, &serv, honorHide, 0);
+@@ -410,12 +302,6 @@ int readServiceInfo(char *name, int type
+     free(filename);
+     *service = serv;
+     return 0;
+-
+-try_xinetd:
+-    free(filename);
+-    if (!(type & TYPE_XINETD))
+-        return -1;
+-    return readXinetdServiceInfo(name, service);
+ }
+ int readServiceDifferences(char *name, int type, struct service *service,
+@@ -426,12 +312,12 @@ int readServiceDifferences(char *name, i
+     int parseret;
+     if (!(type & TYPE_INIT_D))
+-        goto try_xinetd;
++        return -1;
+     asprintf(&filename, RUNLEVELS "/init.d/%s", name);
  
      if ((fd = open(filename, O_RDONLY)) < 0) {
--          return readXinetdServiceInfo(name,service,honorHide);
-+          return -1;
+-        goto try_xinetd;
++        return -1;
      }
-     fstat(fd, &sb);
  
-@@ -418,60 +336,6 @@
-     globfree(&globres);
-     return 1;
--}
+     free(filename);
+@@ -455,12 +341,6 @@ int readServiceDifferences(char *name, i
+     *service = serv;
+     *service_overrides = serv_overrides;
+     return 0;
 -
--int setXinetdService(struct service s, int on) {
--      int oldfd, newfd;
--      char oldfname[100], newfname[100];
--      char tmpstr[50];
--      char *buf, *ptr, *tmp;
--      struct stat sb;
--      
--      if (on == -1) {
--              on = s.enabled ? 1 : 0;
--      }
--      snprintf(oldfname,100,"%s/%s",XINETDDIR,s.name);
--      if ( (oldfd = open(oldfname,O_RDONLY)) == -1 ) {
--              return -1;
--      }
--      fstat(oldfd,&sb);
--      buf = malloc(sb.st_size+1);
--      if (read(oldfd,buf,sb.st_size)!=sb.st_size) {
--              close(oldfd);
--              free(buf);
--              return -1;
--      }
--      close(oldfd);
--      buf[sb.st_size] = '\0';
--      snprintf(newfname,100,"%s/%s.XXXXXX",XINETDDIR,s.name);
--      newfd = mkstemp(newfname);
--      if (newfd == -1) {
--              free(buf);
--              return -1;
--      }
--      while (buf) {
--              tmp = buf;
--              ptr = strchr(buf,'\n');
--              if (ptr) {
--                      *ptr = '\0';
--                      ptr++;
--              } 
--              while (isspace(*buf)) buf++;
--              if (strncmp(buf,"disable", 7) && strlen(buf)) {
--                      write(newfd,tmp,strlen(tmp));
--                      write(newfd,"\n",1);
--                      if (buf[0] == '{') {
--                              snprintf(tmpstr,50,"\tdisable\t= %s", on ? "no" : "yes");
--                              write(newfd,tmpstr,strlen(tmpstr));
--                              write(newfd,"\n",1);
--                      }
--              }
--              buf = ptr;
--      }
--      close(newfd);
--      chmod(newfname,0644);
--      unlink(oldfname);
--      return(rename(newfname,oldfname));
+-try_xinetd:
+-    free(filename);
+-    if (!(type & TYPE_XINETD))
+-        return -1;
+-    return readXinetdServiceInfo(name, service);
  }
  
+ static struct dep *parseDeps(char *pos, char *end) {
+@@ -863,68 +743,6 @@ int whatLevels(char *name) {
+     return ret;
+ }
+-int setXinetdService(struct service s, int on) {
+-    int oldfd, newfd;
+-    char oldfname[100], newfname[100];
+-    char tmpstr[50];
+-    char *buf, *ptr, *tmp;
+-    struct stat sb;
+-    mode_t mode;
+-    int r;
+-
+-    if (on == -1) {
+-        on = s.enabled ? 1 : 0;
+-    }
+-    snprintf(oldfname, 100, "%s/%s", XINETDDIR, s.name);
+-    if ((oldfd = open(oldfname, O_RDONLY)) == -1) {
+-        return -1;
+-    }
+-    fstat(oldfd, &sb);
+-    buf = malloc(sb.st_size + 1);
+-    if (read(oldfd, buf, sb.st_size) != sb.st_size) {
+-        close(oldfd);
+-        free(buf);
+-        return -1;
+-    }
+-    close(oldfd);
+-    buf[sb.st_size] = '\0';
+-    snprintf(newfname, 100, "%s/%s.XXXXXX", XINETDDIR, s.name);
+-    mode = umask(S_IRWXG | S_IRWXO);
+-    newfd = mkstemp(newfname);
+-    umask(mode);
+-    if (newfd == -1) {
+-        free(buf);
+-        return -1;
+-    }
+-    while (buf) {
+-        tmp = buf;
+-        ptr = strchr(buf, '\n');
+-        if (ptr) {
+-            *ptr = '\0';
+-            ptr++;
+-        }
+-        while (isspace(*buf))
+-            buf++;
+-        if (strncmp(buf, "disable", 7) && strlen(buf)) {
+-            write(newfd, tmp, strlen(tmp));
+-            write(newfd, "\n", 1);
+-            if (buf[0] == '{') {
+-                snprintf(tmpstr, 50, "\tdisable\t= %s", on ? "no" : "yes");
+-                write(newfd, tmpstr, strlen(tmpstr));
+-                write(newfd, "\n", 1);
+-            }
+-        }
+-        buf = ptr;
+-    }
+-    close(newfd);
+-    unlink(oldfname);
+-    r = rename(newfname, oldfname);
+-    if (selinux_restore(oldfname) != 0)
+-        fprintf(stderr, _("Unable to set SELinux context for %s: %s\n"),
+-                oldfname, strerror(errno));
+-    return (r);
+-}
+-
  int doSetService(struct service s, int level, int on) {
-diff -Nru chkconfig-1.2.22/ntsysv.c chkconfig-1.2.22.new/ntsysv.c
---- chkconfig-1.2.22/ntsysv.c  Mon Mar  5 06:51:54 2001
-+++ chkconfig-1.2.22.new/ntsysv.c      Sun Mar 25 03:33:04 2001
-@@ -40,20 +40,14 @@
-     states = alloca(sizeof(*states) * numServices);
-     
-     for (i = 0; i < numServices; i++) {
--      if (services[i].type == TYPE_XINETD) {
--              checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
--                                   services[i].levels ? '*' : ' ', NULL, 
--                                   states + i);
--      } else {
--              for (j = 0; j < 7; j++) {
--                      if (levels & (1 << j)) {
--                              if (isOn(services[i].name, j)) break;
--                      }
-+      for (j = 0; j < 7; j++) {
-+              if (levels & (1 << j)) {
-+                      if (isOn(services[i].name, j)) break;
-               }
--              checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
--                                           (j != 7) ? '*' : ' ', NULL, 
--                                           states + i);
-       }
-+      checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
-+                                   (j != 7) ? '*' : ' ', NULL, 
-+                                   states + i);
-       newtFormAddComponent(subform, checkboxes[i]);
-     }
+     int priority = on ? s.sPriority : s.kPriority;
+     char linkname[200];
+diff -urNpa chkconfig-1.15.orig/leveldb.h chkconfig-1.15/leveldb.h
+--- chkconfig-1.15.orig/leveldb.h      2021-01-21 09:19:06.000000000 +0100
++++ chkconfig-1.15/leveldb.h   2021-05-03 17:47:25.388139905 +0200
+@@ -17,14 +17,12 @@
+ #define H_LEVELDB
  
-@@ -110,13 +104,9 @@
-     if (!update) return 1;
+ #define RUNLEVELS "/etc"
+-#define XINETDDIR "/etc/xinetd.d"
  
-     for (i = 0; i < numServices; i++) {
--      if (services[i].type == TYPE_XINETD)
--            setXinetdService(services[i], states[i] == '*');
--      else {
--            for (j = 0; j < 7; j++) {
--                    if (levels & (1 << j))
--                      doSetService(services[i], j, states[i] == '*');
--            }
-+      for (j = 0; j < 7; j++) {
-+            if (levels & (1 << j))
-+              doSetService(services[i], j, states[i] == '*');
-       }
-     }
+ #include <glob.h>
  
-@@ -186,50 +176,6 @@
-     }
+ #define TYPE_INIT_D 0x1
+-#define TYPE_XINETD 0x2
+ #define TYPE_SYSTEMD 0x4
+-#define TYPE_ANY (TYPE_INIT_D | TYPE_XINETD | TYPE_SYSTEMD)
++#define TYPE_ANY (TYPE_INIT_D | TYPE_SYSTEMD)
+ #ifndef SYSTEMD_SERVICE_PATH
+ #define SYSTEMD_SERVICE_PATH "/lib/systemd/system"
+@@ -71,8 +69,6 @@ int isConfigured(char *name, int level,
+ int whatLevels(char *name);
+ int doSetService(struct service s, int level, int on);
+ int findServiceEntries(char *name, int level, glob_t *globresptr);
+-int readXinetdServiceInfo(char *name, struct service *service);
+-int setXinetdService(struct service s, int on);
+ int systemdIsInit();
+ int systemdActive();
+ int isOverriddenBySystemd(const char *service);
+diff -urNpa chkconfig-1.15.orig/ntsysv.c chkconfig-1.15/ntsysv.c
+--- chkconfig-1.15.orig/ntsysv.c       2021-01-21 09:19:06.000000000 +0100
++++ chkconfig-1.15/ntsysv.c    2021-05-03 17:45:56.483139905 +0200
+@@ -69,19 +69,13 @@ static int servicesWindow(struct service
+                 newtCompactButton(-1, count,
+                                   services[i].type == TYPE_INIT_D
+                                       ? "SysV initscripts"
+-                                      : services[i].type == TYPE_XINETD
+-                                            ? "xinetd services"
+                                             : services[i].type == TYPE_SYSTEMD
+                                                   ? "systemd services"
+                                                   : "Unknown"));
+             count++;
+             last = services[i].type;
+         }
+-        if (services[i].type == TYPE_XINETD) {
+-            checkboxes[i] =
+-                newtCheckbox(-1, count, services[i].name,
+-                             services[i].levels ? '*' : ' ', NULL, states + i);
+-        } else if (services[i].type == TYPE_SYSTEMD) {
++        if (services[i].type == TYPE_SYSTEMD) {
+             checkboxes[i] =
+                 newtCheckbox(-1, count, services[i].name,
+                              services[i].enabled ? '*' : ' ', NULL, states + i);
+@@ -150,11 +144,7 @@ static int servicesWindow(struct service
+         return 1;
+     for (i = 0; i < numServices; i++) {
+-        if (services[i].type == TYPE_XINETD) {
+-            if ((services[i].enabled && states[i] != '*') ||
+-                (!services[i].enabled && states[i] == '*'))
+-                setXinetdService(services[i], states[i] == '*');
+-        } else if (services[i].type == TYPE_SYSTEMD) {
++        if (services[i].type == TYPE_SYSTEMD) {
+             char *cmd = NULL;
+             int en = 0;
+             if (services[i].enabled && states[i] != '*')
+@@ -368,50 +358,6 @@ static int getServices(struct service **
  
      closedir(dir);
+-    if (!stat("/usr/sbin/xinetd", &sb)) {
+-        if (!(dir = opendir(XINETDDIR))) {
+-            fprintf(stderr, "failed to open " XINETDDIR ": %s\n",
+-                    strerror(errno));
+-            return 2;
+-        }
 -
--    if (!stat("/usr/sbin/xinetd",&sb)) {
--    if (!(dir = opendir(XINETDDIR))) {
--      fprintf(stderr, "failed to open " XINETDDIR ": %s\n",
--              strerror(errno));
--        return 2;
--    }
+-        while ((ent = readdir(dir))) {
+-            if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') ||
+-                strchr(ent->d_name, '.'))
+-                continue;
 -
--    while ((ent = readdir(dir))) {
--      if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') ||
--          strchr(ent->d_name, '.')) continue;
+-            sprintf(fn, "%s/%s", XINETDDIR, ent->d_name);
+-            if (stat(fn, &sb)) {
+-                err = errno;
+-                continue;
+-            }
+-            if (!S_ISREG(sb.st_mode))
+-                continue;
 -
--      sprintf(fn, "%s/%s", XINETDDIR, ent->d_name);
--      if (stat(fn, &sb))
--      {
--              err = errno;
--              continue;
--      }
--      if (!S_ISREG(sb.st_mode)) continue;
+-            if (numServices == numServicesAlloced) {
+-                numServicesAlloced += 10;
+-                services =
+-                    realloc(services, numServicesAlloced * sizeof(*services));
+-            }
 -
--      if (numServices == numServicesAlloced) {
--          numServicesAlloced += 10;
--          services = realloc(services, 
--                              numServicesAlloced * sizeof(*services));
--      }
+-            rc = readXinetdServiceInfo(ent->d_name, services + numServices);
 -
--      rc = readXinetdServiceInfo(ent->d_name, services + numServices, honorHide);
--      
--      if (rc == -1) {
--          fprintf(stderr, _("error reading info for service %s: %s\n"),
--                      ent->d_name, strerror(errno));
--          closedir(dir);
--          return 2;
--      } else if (!rc)
--          numServices++;
--    }
+-            if (rc == -1) {
+-                fprintf(stderr, _("error reading info for service %s: %s\n"),
+-                        ent->d_name, strerror(errno));
+-                closedir(dir);
+-                return 2;
+-            } else if (!rc)
+-                numServices++;
+-        }
 -
--    if (err) {
--      fprintf(stderr, _("error reading from directory %s: %s\n"),
--              XINETDDIR, strerror(err));
--        return 1;
--    }
+-        if (err) {
+-            fprintf(stderr, _("error reading from directory %s: %s\n"),
+-                    XINETDDIR, strerror(err));
+-            return 1;
+-        }
 -    }
 -
-     qsort(services, numServices, sizeof(*services), serviceNameCmp);
+     getSystemdServices(&services, &numServices);
  
-     *servicesPtr = services;
+     qsort(services, numServices, sizeof(*services), serviceNameCmp);
This page took 0.101384 seconds and 4 git commands to generate.