]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/misc-progs/setuid.h
Updated strongswan (4.4.1).
[people/pmueller/ipfire-2.x.git] / src / misc-progs / setuid.h
index 86e260319e84ecea9e2941834ff490e129592a64..e253a765704b0cdb0154293d59ce854faac48ee4 100644 (file)
@@ -1,91 +1,74 @@
-/* SmoothWall helper program - header file\r
- *\r
- * This program is distributed under the terms of the GNU General Public\r
- * Licence.  See the file COPYING for details.\r
- * Simple header file for all setuid progs.\r
- * \r
- * $Id: setuid.h,v 1.4.2.4 2005/11/20 23:20:13 franck78 Exp $\r
- * \r
- */\r
-\r
-#ifndef SETUID_H\r
-#define SETUID_H 1\r
-\r
-#include <stdlib.h>\r
-#include <sys/types.h>\r
-\r
-/* As nothing in setuid.c uses STRING_SIZE specifically there's no real reason\r
- * to redefine it if it already is set */\r
-#ifndef STRING_SIZE\r
-#define STRING_SIZE 256\r
-#endif\r
-#define LETTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\r
-#define NUMBERS "0123456789"\r
-#define LETTERS_NUMBERS LETTERS NUMBERS\r
-#define IP_NUMBERS "./" NUMBERS\r
-#define PORT_NUMBERS ":-" NUMBERS\r
-#define VALID_FQDN LETTERS_NUMBERS ".-"\r
-\r
-\r
-#define VALID_IP(ip) (strlen(ip) > 6 \\r
-                   && strlen(ip) < 16 \\r
-                   && strspn(ip, NUMBERS ".") == strlen(ip))\r
-\r
-#define VALID_IP_AND_MASK(ip) (strlen(ip) > 6 \\r
-                            && strlen(ip) < 32 \\r
-                            && strspn(ip, IP_NUMBERS) == strlen(ip))\r
-\r
-#define VALID_PORT(port) (strlen(port) \\r
-                       && strlen(port) < 6 \\r
-                       && strspn(port, NUMBERS) == strlen(port))\r
-\r
-#define VALID_PORT_RANGE(port) (strlen(port) \\r
-                             && strlen(port) < 12 \\r
-                             && strspn(port, PORT_NUMBERS) == strlen(port))\r
-\r
-#define VALID_SHORT_MASK(ip) (strlen(ip) > 1 \\r
-                             && strlen(ip) < 3 \\r
-                             && strspn(ip, NUMBERS) == strlen(ip))\r
-\r
-/* Can't find any info on valid characters/length hopefully these are\r
- * reasonable guesses */\r
-#define VALID_DEVICE(dev) (strlen(dev) \\r
-                        && strlen(dev) < 16 \\r
-                        && strspn(dev, LETTERS_NUMBERS ":.") == strlen(dev))\r
-\r
-/* Again, can't find any hard and fast rules for protocol names, these\r
- * restrictions are based on the keywords currently listed in\r
- * <http://www.iana.org/assignments/protocol-numbers>\r
- * though currently the ipcop cgis will only pass tcp, udp or gre anyway */\r
-#define VALID_PROTOCOL(prot) (strlen(prot) \\r
-                          &&  strlen(prot) <16 \\r
-                          &&  strspn(prot, LETTERS_NUMBERS "-") == strlen(prot))\r
-\r
-extern char * trusted_env[4];\r
-\r
-int system_core(char* command, uid_t uid, gid_t gid, char *error);\r
-int safe_system(char* command);\r
-int unpriv_system(char* command, uid_t uid, gid_t gid);\r
-size_t strlcat(char *dst, const char *src, size_t len);\r
-int initsetuid(void);\r
-\r
-/* check whether a file exists */\r
-int file_exists(const char *fname);        \r
-int file_exists_w(const char *fname); //wildcard filename test     \r
-\r
-// Backup restore\r
-#define MOUNTPOINT "/home/httpd/html/backup"\r
-#define BACKUP_KEY CONFIG_ROOT"/backup/backup.key"\r
-\r
-/* defines for config create/restore return status*/\r
-#define ERR_ANY      1   // unspecified error\r
-#define ERR_KEY      2   // error creating key file\r
-#define ERR_TAR      3   // error creating .tar\r
-#define ERR_GZ       4   // error creating .tar.gz\r
-#define ERR_ENCRYPT  5   // error creating .dat\r
-#define ERR_DECRYPT  6   // error decrypting .dat file\r
-#define ERR_UNTARTST 7   // error (test) untarring .tar.gz\r
-#define ERR_UNTAR    8   // error (real) untarring .tar.gz\r
-#define ERR_DAT      9   // missing .dat file\r
-\r
-#endif\r
+/* SmoothWall helper program - header file
+ *
+ * This program is distributed under the terms of the GNU General Public
+ * Licence.  See the file COPYING for details.
+ * Simple header file for all setuid progs.
+ * 
+ */
+
+#ifndef SETUID_H
+#define SETUID_H 1
+
+#include <stdlib.h>
+#include <sys/types.h>
+
+/* As nothing in setuid.c uses STRING_SIZE specifically there's no real reason
+ * to redefine it if it already is set */
+#ifndef STRING_SIZE
+#define STRING_SIZE 256
+#endif
+#define LETTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+#define NUMBERS "0123456789"
+#define LETTERS_NUMBERS LETTERS NUMBERS
+#define IP_NUMBERS "./" NUMBERS
+#define PORT_NUMBERS ":-" NUMBERS
+#define VALID_FQDN LETTERS_NUMBERS ".-"
+
+
+#define VALID_IP(ip) (strlen(ip) > 6 \
+                   && strlen(ip) < 16 \
+                   && strspn(ip, NUMBERS ".") == strlen(ip))
+
+#define VALID_IP_AND_MASK(ip) (strlen(ip) > 6 \
+                            && strlen(ip) < 32 \
+                            && strspn(ip, IP_NUMBERS) == strlen(ip))
+
+#define VALID_PORT(port) (strlen(port) \
+                       && strlen(port) < 6 \
+                       && strspn(port, NUMBERS) == strlen(port))
+
+#define VALID_PORT_RANGE(port) (strlen(port) \
+                             && strlen(port) < 12 \
+                             && strspn(port, PORT_NUMBERS) == strlen(port))
+
+#define VALID_SHORT_MASK(ip) (strlen(ip) > 1 \
+                             && strlen(ip) < 3 \
+                             && strspn(ip, NUMBERS) == strlen(ip))
+
+/* Can't find any info on valid characters/length hopefully these are
+ * reasonable guesses */
+#define VALID_DEVICE(dev) (strlen(dev) \
+                        && strlen(dev) < 16 \
+                        && strspn(dev, LETTERS_NUMBERS ":.") == strlen(dev))
+
+/* Again, can't find any hard and fast rules for protocol names, these
+ * restrictions are based on the keywords currently listed in
+ * <http://www.iana.org/assignments/protocol-numbers>
+ * though currently the ipcop cgis will only pass tcp, udp or gre anyway */
+#define VALID_PROTOCOL(prot) (strlen(prot) \
+                          &&  strlen(prot) <16 \
+                          &&  strspn(prot, LETTERS_NUMBERS "-") == strlen(prot))
+
+extern char * trusted_env[4];
+
+int system_core(char* command, uid_t uid, gid_t gid, char *error);
+int safe_system(char* command);
+int unpriv_system(char* command, uid_t uid, gid_t gid);
+size_t strlcat(char *dst, const char *src, size_t len);
+int initsetuid(void);
+
+/* check whether a file exists */
+int file_exists(const char *fname);        
+int file_exists_w(const char *fname); //wildcard filename test
+
+#endif