X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Flibbb.h;h=0bc35641526e2f0be3f0c6d2568e23e64a43dd9d;hb=60a22addea1a809878758e7b5cc1b0386ea9990a;hp=a7e38325b88115ffb76f6d3fa20f012a440e2d2f;hpb=a7cecbc9170eed93d365c0c38e8ba1477ab0a40c;p=oweals%2Fbusybox.git diff --git a/include/libbb.h b/include/libbb.h index a7e38325b..0bc356415 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -21,8 +21,8 @@ * Permission has been granted to redistribute this code under the GPL. * */ -#ifndef __LIBBB_H__ -#define __LIBBB_H__ 1 +#ifndef __LIBCONFIG_H__ +#define __LIBCONFIG_H__ 1 #include #include @@ -32,15 +32,23 @@ #include #ifdef DMALLOC -#include "dmalloc.h" +#include #endif #include -#ifndef _BB_INTERNAL_H_ -#include "../busybox.h" +#include "config.h" + +#include "pwd_.h" +#include "grp_.h" +#ifdef CONFIG_FEATURE_SHADOWPASSWDS +#include "shadow_.h" +#endif +#ifdef CONFIG_FEATURE_SHA1_PASSWORDS +# include "sha1.h" #endif + #if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__) /* libc5 doesn't define socklen_t */ typedef unsigned int socklen_t; @@ -62,9 +70,6 @@ char *strtok_r(char *s, const char *delim, char **ptrptr); #define BUF_SIZE 8192 #define EXPAND_ALLOC 1024 -static inline int is_decimal(int ch) { return ((ch >= '0') && (ch <= '9')); } -static inline int is_octal(int ch) { return ((ch >= '0') && (ch <= '7')); } - /* Macros for min/max. */ #ifndef MIN #define MIN(a,b) (((a)<(b))?(a):(b)) @@ -120,7 +125,7 @@ extern void write_mtab(char* blockDevice, char* directory, char* filesystemType, long flags, char* string_flags); extern void erase_mtab(const char * name); extern long atoi_w_units (const char *cp); -extern pid_t* find_pid_by_name( char* pidName); +extern long* find_pid_by_name( char* pidName); extern char *find_real_root_device_name(const char* name); extern char *get_line_from_file(FILE *file); extern void print_file(FILE *file); @@ -216,50 +221,21 @@ char *last_char_is(const char *s, int c); extern long arith (const char *startbuf, int *errcode); -typedef struct file_headers_s { - char *name; - char *link_name; - off_t size; - uid_t uid; - gid_t gid; - mode_t mode; - time_t mtime; - dev_t device; -} file_header_t; -file_header_t *get_header_ar(FILE *in_file); -file_header_t *get_header_cpio(FILE *src_stream); -file_header_t *get_header_tar(FILE *tar_stream); - -enum extract_functions_e { - extract_verbose_list = 1, - extract_list = 2, - extract_one_to_buffer = 4, - extract_to_stdout = 8, - extract_all_to_fs = 16, - extract_preserve_date = 32, - extract_data_tar_gz = 64, - extract_control_tar_gz = 128, - extract_unzip_only = 256, - extract_unconditional = 512, - extract_create_leading_dirs = 1024, - extract_quiet = 2048, - extract_exclude_list = 4096 -}; -char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_header)(FILE *), - const int extract_function, const char *prefix, char **extract_names); -char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function, - const char *prefix, const char *filename); int read_package_field(const char *package_buffer, char **field_name, char **field_value); char *fgets_str(FILE *file, const char *terminating_string); +extern int inflate(FILE *in, FILE *out); extern int unzip(FILE *l_in_file, FILE *l_out_file); extern void gz_close(int gunzip_pid); extern FILE *gz_open(FILE *compressed_file, int *pid); extern struct hostent *xgethostbyname(const char *name); +extern struct hostent *xgethostbyname2(const char *name, int af); extern int create_icmp_socket(void); +extern int create_icmp6_socket(void); +extern int xconnect(const char *host, const char *port); -char *dirname (const char *path); +char *dirname (char *path); int make_directory (char *path, long mode, int flags); @@ -273,7 +249,7 @@ char *simplify_path(const char *path); enum { FILEUTILS_PRESERVE_STATUS = 1, - FILEUTILS_PRESERVE_SYMLINKS = 2, + FILEUTILS_DEREFERENCE = 2, FILEUTILS_RECUR = 4, FILEUTILS_FORCE = 8, FILEUTILS_INTERACTIVE = 16 @@ -294,8 +270,17 @@ extern const char * const too_few_args; extern const char * const name_longer_than_foo; extern const char * const unknown; extern const char * const can_not_create_raw_socket; - -#ifdef BB_FEATURE_DEVFS +extern const char * const nologin_file; +extern const char * const passwd_file; +extern const char * const shadow_file; +extern const char * const gshadow_file; +extern const char * const group_file; +extern const char * const securetty_file; +extern const char * const motd_file; +extern const char * const issue_file; +extern const char * const _path_login; + +#ifdef CONFIG_FEATURE_DEVFS # define CURRENT_VC "/dev/vc/0" # define VC_1 "/dev/vc/1" # define VC_2 "/dev/vc/2" @@ -306,6 +291,7 @@ extern const char * const can_not_create_raw_socket; # define SC_1 "/dev/tts/1" # define VC_FORMAT "/dev/vc/%d" # define SC_FORMAT "/dev/tts/%d" +# define LOOP_FORMAT "/dev/loop/%d" #else # define CURRENT_VC "/dev/tty0" # define VC_1 "/dev/tty1" @@ -317,10 +303,32 @@ extern const char * const can_not_create_raw_socket; # define SC_1 "/dev/ttyS1" # define VC_FORMAT "/dev/tty%d" # define SC_FORMAT "/dev/ttyS%d" +# define LOOP_FORMAT "/dev/loop%d" #endif /* The following devices are the same on devfs and non-devfs systems. */ #define CURRENT_TTY "/dev/tty" #define CONSOLE_DEV "/dev/console" -#endif /* __LIBBB_H__ */ +int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name); +void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); +void reset_ino_dev_hashtable(void); + +/* Stupid gcc always includes its own builtin strlen()... */ +extern size_t xstrlen(const char *string); +#define strlen(x) xstrlen(x) + +void bb_asprintf(char **string_ptr, const char *format, ...) __attribute__ ((format (printf, 2, 3))); + + +#define FAIL_DELAY 3 +extern void change_identity ( const struct passwd *pw ); +extern void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args ); +extern int restricted_shell ( const char *shell ); +extern void setup_environment ( const char *shell, int loginshell, int changeenv, const struct passwd *pw ); +extern int correct_password ( const struct passwd *pw ); +extern char *pw_encrypt(const char *clear, const char *salt); +extern struct spwd *pwd_to_spwd(const struct passwd *pw); +extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); + +#endif /* __LIBCONFIG_H__ */