mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
Minor: relocate code to get rid of #ifdefs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
ba9ae0337d
commit
e38eb7cbd5
3 files changed
+32
-36
No files matched your search
@@ -635,6 +635,23 @@ int inetd_filter_str(inetd_t *inetd, char *str, size_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svc_t *inetd_find_svc(char *path, char *service, char *proto)
|
||||||
|
{
|
||||||
|
svc_t *svc;
|
||||||
|
|
||||||
|
for (svc = svc_inetd_iterator(1); svc; svc = svc_inetd_iterator(0)) {
|
||||||
|
if (strncmp(path, svc->cmd, strlen(svc->cmd)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (inetd_match(&svc->inetd, service, proto)) {
|
||||||
|
_d("Found a matching inetd svc for %s %s %s", path, service, proto);
|
||||||
|
return svc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is called to add a new, unique, inetd service. When an
|
* This function is called to add a new, unique, inetd service. When an
|
||||||
* ifname is given as argument this means *only* run service on this
|
* ifname is given as argument this means *only* run service on this
|
||||||
|
|||||||
@@ -54,22 +54,23 @@ typedef struct {
|
|||||||
TAILQ_HEAD(, inetd_filter) filters;
|
TAILQ_HEAD(, inetd_filter) filters;
|
||||||
} inetd_t;
|
} inetd_t;
|
||||||
|
|
||||||
int inetd_check_loop (struct sockaddr *sa, socklen_t len, char *name);
|
int inetd_check_loop(struct sockaddr *sa, socklen_t len, char *name);
|
||||||
|
|
||||||
int inetd_start (inetd_t *inetd);
|
int inetd_start (inetd_t *inetd);
|
||||||
void inetd_stop (inetd_t *inetd);
|
void inetd_stop (inetd_t *inetd);
|
||||||
|
|
||||||
int inetd_new (inetd_t *inetd, char *name, char *service, char *proto,
|
int inetd_new (inetd_t *inetd, char *name, char *service, char *proto, int forking, svc_t *svc);
|
||||||
int forking, svc_t *svc);
|
int inetd_del (inetd_t *inetd);
|
||||||
int inetd_del (inetd_t *inetd);
|
|
||||||
|
|
||||||
int inetd_match (inetd_t *inetd, char *service, char *proto);
|
svc_t *inetd_find_svc (char *path, char *service, char *proto);
|
||||||
int inetd_filter_str (inetd_t *inetd, char *str, size_t len);
|
|
||||||
|
|
||||||
int inetd_flush (inetd_t *inetd);
|
int inetd_match (inetd_t *inetd, char *service, char *proto);
|
||||||
int inetd_allow (inetd_t *inetd, char *ifname);
|
int inetd_filter_str(inetd_t *inetd, char *str, size_t len);
|
||||||
int inetd_deny (inetd_t *inetd, char *ifname);
|
|
||||||
int inetd_is_allowed (inetd_t *inetd, char *ifname);
|
int inetd_flush (inetd_t *inetd);
|
||||||
|
int inetd_allow (inetd_t *inetd, char *ifname);
|
||||||
|
int inetd_deny (inetd_t *inetd, char *ifname);
|
||||||
|
int inetd_is_allowed(inetd_t *inetd, char *ifname);
|
||||||
|
|
||||||
#endif /* FINIT_INETD_H_ */
|
#endif /* FINIT_INETD_H_ */
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,8 @@
|
|||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "utmp-api.h"
|
#include "utmp-api.h"
|
||||||
|
|
||||||
#define RESPAWN_MAX 10 /* Prevent endless respawn of faulty services. */
|
#define RESPAWN_MAX 10 /* Prevent endless respawn of faulty services. */
|
||||||
|
|
||||||
#ifndef INETD_DISABLED
|
|
||||||
static svc_t *find_inetd_svc (char *path, char *service, char *proto);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* service_enabled - Should the service run?
|
* service_enabled - Should the service run?
|
||||||
@@ -649,7 +646,7 @@ int service_register(int type, char *line, time_t mtime, char *username)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check if known inetd, then add ifnames for filtering only. */
|
/* Check if known inetd, then add ifnames for filtering only. */
|
||||||
svc = find_inetd_svc(cmd, service, proto);
|
svc = inetd_find_svc(cmd, service, proto);
|
||||||
if (svc)
|
if (svc)
|
||||||
goto inetd_setup;
|
goto inetd_setup;
|
||||||
|
|
||||||
@@ -1032,25 +1029,6 @@ void service_step_all(int types)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef INETD_DISABLED
|
|
||||||
static svc_t *find_inetd_svc(char *path, char *service, char *proto)
|
|
||||||
{
|
|
||||||
svc_t *svc;
|
|
||||||
|
|
||||||
for (svc = svc_inetd_iterator(1); svc; svc = svc_inetd_iterator(0)) {
|
|
||||||
if (strncmp(path, svc->cmd, strlen(svc->cmd)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (inetd_match(&svc->inetd, service, proto)) {
|
|
||||||
_d("Found a matching inetd svc for %s %s %s", path, service, proto);
|
|
||||||
return svc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
* indent-tabs-mode: t
|
* indent-tabs-mode: t
|
||||||
|
|||||||
Reference in new issue
Block a user