version 1.1, 2012/02/21 16:23:02
|
version 1.1.1.3, 2013/07/22 10:46:13
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 2010-2011 Todd C. Miller <Todd.Miller@courtesan.com> | * Copyright (c) 2010-2013 Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 29 struct generic_plugin {
|
Line 29 struct generic_plugin {
|
/* |
/* |
* Backwards-compatible structures for API bumps. |
* Backwards-compatible structures for API bumps. |
*/ |
*/ |
|
struct policy_plugin_1_0 { |
|
unsigned int type; |
|
unsigned int version; |
|
int (*open)(unsigned int version, sudo_conv_t conversation, |
|
sudo_printf_t sudo_printf, char * const settings[], |
|
char * const user_info[], char * const user_env[]); |
|
void (*close)(int exit_status, int error); /* wait status or error */ |
|
int (*show_version)(int verbose); |
|
int (*check_policy)(int argc, char * const argv[], |
|
char *env_add[], char **command_info[], |
|
char **argv_out[], char **user_env_out[]); |
|
int (*list)(int argc, char * const argv[], int verbose, |
|
const char *list_user); |
|
int (*validate)(void); |
|
void (*invalidate)(int remove); |
|
int (*init_session)(struct passwd *pwd); |
|
}; |
struct io_plugin_1_0 { |
struct io_plugin_1_0 { |
unsigned int type; |
unsigned int type; |
unsigned int version; |
unsigned int version; |
Line 44 struct io_plugin_1_0 {
|
Line 61 struct io_plugin_1_0 {
|
int (*log_stdout)(const char *buf, unsigned int len); |
int (*log_stdout)(const char *buf, unsigned int len); |
int (*log_stderr)(const char *buf, unsigned int len); |
int (*log_stderr)(const char *buf, unsigned int len); |
}; |
}; |
|
struct io_plugin_1_1 { |
|
unsigned int type; |
|
unsigned int version; |
|
int (*open)(unsigned int version, sudo_conv_t conversation, |
|
sudo_printf_t sudo_printf, char * const settings[], |
|
char * const user_info[], char * const command_info[], |
|
int argc, char * const argv[], char * const user_env[]); |
|
void (*close)(int exit_status, int error); /* wait status or error */ |
|
int (*show_version)(int verbose); |
|
int (*log_ttyin)(const char *buf, unsigned int len); |
|
int (*log_ttyout)(const char *buf, unsigned int len); |
|
int (*log_stdin)(const char *buf, unsigned int len); |
|
int (*log_stdout)(const char *buf, unsigned int len); |
|
int (*log_stderr)(const char *buf, unsigned int len); |
|
}; |
|
|
/* |
/* |
* Sudo plugin internals. |
* Sudo plugin internals. |
*/ |
*/ |
|
|
struct plugin_info { |
|
struct plugin_info *prev; /* required */ |
|
struct plugin_info *next; /* required */ |
|
const char *path; |
|
const char *symbol_name; |
|
}; |
|
TQ_DECLARE(plugin_info) |
|
|
|
struct plugin_container { |
struct plugin_container { |
struct plugin_container *prev; /* required */ |
struct plugin_container *prev; /* required */ |
struct plugin_container *next; /* required */ |
struct plugin_container *next; /* required */ |
const char *name; |
const char *name; |
|
char * const *options; |
void *handle; |
void *handle; |
union { |
union { |
struct generic_plugin *generic; |
struct generic_plugin *generic; |
struct policy_plugin *policy; |
struct policy_plugin *policy; |
|
struct policy_plugin_1_0 *policy_1_0; |
struct io_plugin *io; |
struct io_plugin *io; |
struct io_plugin_1_0 *io_1_0; |
struct io_plugin_1_0 *io_1_0; |
|
struct io_plugin_1_1 *io_1_1; |
} u; |
} u; |
}; |
}; |
TQ_DECLARE(plugin_container) |
TQ_DECLARE(plugin_container) |
|
|
extern struct plugin_container_list policy_plugins; | extern struct plugin_container policy_plugin; |
extern struct plugin_container_list io_plugins; |
extern struct plugin_container_list io_plugins; |
|
|
int sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[], |
int sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[], |
struct sudo_conv_reply replies[]); |
struct sudo_conv_reply replies[]); |
int _sudo_printf(int msg_type, const char *fmt, ...); |
int _sudo_printf(int msg_type, const char *fmt, ...); |
|
|
int sudo_load_plugins(const char *conf_file, | bool sudo_load_plugins(struct plugin_container *policy_plugin, |
struct plugin_container *policy_plugin, | |
struct plugin_container_list *io_plugins); |
struct plugin_container_list *io_plugins); |
|
|
#endif /* _SUDO_PLUGIN_INT_H */ |
#endif /* _SUDO_PLUGIN_INT_H */ |