chiark / gitweb /
[PATCH] remove untrusted chars read from sysfs-values or returned by PROGRAM
[elogind.git] / udev_utils.h
index 3bb1b25362a2dfcb6aa351446da17eea09ea7591..5ebc9e5bb6f830cdeb243cf9c35dccc9d513b0f3 100644 (file)
 
 #include "udev.h"
 
 
 #include "udev.h"
 
-#define strfieldcpy(to, from) \
-do { \
-       to[sizeof(to)-1] = '\0'; \
-       strncpy(to, from, sizeof(to)-1); \
-} while (0)
-
-#define strfieldcat(to, from) \
-do { \
-       to[sizeof(to)-1] = '\0'; \
-       strncat(to, from, sizeof(to) - strlen(to)-1); \
-} while (0)
-
-#define strfieldcpymax(to, from, maxsize) \
-do { \
-       to[maxsize-1] = '\0'; \
-       strncpy(to, from, maxsize-1); \
-} while (0)
-
-#define strfieldcatmax(to, from, maxsize) \
-do { \
-       to[maxsize-1] = '\0'; \
-       strncat(to, from, maxsize - strlen(to)-1); \
-} while (0)
-
-#ifdef asmlinkage
-# undef asmlinkage
-#endif
-#ifdef __i386__
-# define asmlinkage    __attribute__((regparm(0)))
-#endif
-#ifndef asmlinkage
-# define asmlinkage
-#endif
-
 struct name_entry {
        struct list_head node;
 struct name_entry {
        struct list_head node;
-       char name[NAME_SIZE];
+       char name[PATH_SIZE];
 };
 
 extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem);
 };
 
 extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem);
@@ -73,8 +39,9 @@ extern int unlink_secure(const char *filename);
 extern int file_map(const char *filename, char **buf, size_t *bufsize);
 extern void file_unmap(char *buf, size_t bufsize);
 extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur);
 extern int file_map(const char *filename, char **buf, size_t *bufsize);
 extern void file_unmap(char *buf, size_t bufsize);
 extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur);
-extern void no_trailing_slash(char *path);
+extern void remove_trailing_char(char *path, char c);
+extern void replace_untrusted_chars(char *string);
 extern int name_list_add(struct list_head *name_list, const char *name, int sort);
 extern int name_list_add(struct list_head *name_list, const char *name, int sort);
-extern int call_foreach_file(int (*handler_function)(struct udevice *udev, const char *string),
-                            struct udevice *udev, const char *dirname, const char *suffix);
+extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix);
+
 #endif
 #endif