Rose
97f8052427
Add restrict to strlcpy and expand_prompt
2023-10-17 10:33:15 -06:00
Todd C. Miller
2d437c793d
Fix spelling: resistent -> resistant
2023-10-12 10:20:34 -06:00
Todd C. Miller
29feb41da2
max_groups in sudoers_plugin_settings is no longer used.
2023-09-25 11:32:15 -06:00
Todd C. Miller
e343e07543
Use #include <foo.h> instead of #include "foo.h" in most cases.
...
We rely on the include path to find many of these headers. It
especially doesn't make sense to use #include "foo.h" for headers
in the top-level include directory.
2023-09-25 10:13:28 -06:00
Todd C. Miller
6e75f2311d
Add resolve_cmnd(), a wrapper around find_path().
...
This is a convenience function that sets PERM_RUNAS and calls
find_path(). If the command is not found it will retry with PERM_USER
instead.
2023-09-18 12:42:51 -06:00
Todd C. Miller
8fcb21b5cd
Promote strict field in sudoers_parser_config from bool to int.
...
This will be used by visudo to indicate when "visudo -s" is run.
2023-09-18 12:42:51 -06:00
Todd C. Miller
c277e55f42
Rename callbacks.c -> sudoers_cb.c.
2023-09-18 12:42:51 -06:00
Todd C. Miller
a127ddf6db
Undefine AUTH_{SUCCESS,FAILURE,ERROR} before defining them.
...
Quiets a warning on AIX where usersec.h defines AUTH_SUCCESS and
AUTH_FAILURE. We avoided this problem in the past because the old
values for AUTH_SUCCESS and AUTH_FAILURE match what AIX defines.
2023-09-15 10:53:28 -06:00
Todd C. Miller
51d6b0f425
Promote verbose flag to int for display_privs and display_cmnd.
...
A negative verbosity will prevent non-error output from being
displayed.
2023-09-15 10:01:35 -06:00
Todd C. Miller
b8f2680cf0
Make flag in union sudo_defs_val bool to match how it is used.
...
Adjust find_path()'s ignore_dot function argument to match.
2023-09-13 14:59:29 -06:00
Todd C. Miller
a9801cc99d
Parse euid and egid from sudo front-end.
...
These are needed by bsm_audit.c.
2023-09-13 12:43:39 -06:00
Todd C. Miller
38ddbb14f1
Parse pid and ppid from sudo front-end.
...
We can now use the stored ppid in ts_init_key().
2023-09-13 12:29:40 -06:00
Todd C. Miller
0b52ffd1a2
Don't expose the implementation of the pivot_root state.
2023-09-11 16:15:41 -06:00
Todd C. Miller
c54bdd799b
Return AUTH_* flags from check_user() instead of 1/0/-1.
2023-09-09 14:59:46 -06:00
Todd C. Miller
2fdb4db339
Wrap valid_shell and add to sudo_pwutil_set_backend().
...
This will make it possible to support a different getusershell()
implementation for testsudoers in the future.
2023-09-09 14:48:25 -06:00
Todd C. Miller
d18ee8e0e7
Move check_user_shell() to pwutil.c as user_shell_valid()
...
This will make it possible to support a different backend which may
be used by testsudoers in the future.
2023-09-09 14:07:28 -06:00
Todd C. Miller
956de5cbbc
sudoers_sethost: refactor code to set host names in sudoers_context.
...
The sudoers_sethost() function can be shared by the sudoers plugin,
visudo, cvtsudoers and testsudoers.
2023-09-02 15:25:58 -06:00
Todd C. Miller
05f823df22
Move sudoers_debug.c prototypes to sudoers_debug.h.
2023-08-29 13:54:45 -06:00
Todd C. Miller
35a7283dd9
sudo_conv, sudo_printf and plugin_event_alloc live in policy.c.
2023-08-29 13:46:43 -06:00
Todd C. Miller
75209e2718
Rename check.h -> timestamp.h and add remaining timestamp.c prototypes.
2023-08-29 11:16:23 -06:00
Todd C. Miller
3c05e748a4
Add ignore_perms plugin argument to skip the sudoers file security checks.
...
This is not intended to be used in a production environment.
2023-08-29 09:55:09 -06:00
Todd C. Miller
30fc288291
Move tty_present() into policy.c as sudoers_tty_present().
...
This function is policy-dependent. For the modern sudo front-end
it will simply check tcpgid and/or ttypath.
2023-08-25 11:19:42 -06:00
Todd C. Miller
091051125b
Move timestampowner sudoers callback to timestamp.c.
2023-08-22 17:04:08 -06:00
Todd C. Miller
c7157ce0b1
Move a few fields from sudoers_user_contect to sudoers_context.
...
They are not really specific to the user or user-specified.
2023-08-21 15:30:12 -06:00
Todd C. Miller
8161205447
MODE_KILL is never set in the sudoers plugin, remove it.
2023-08-21 12:52:21 -06:00
Todd C. Miller
ff5914d7f7
Move sudoedit_nfiles into struct sudoers_context.
2023-08-21 10:47:25 -06:00
Todd C. Miller
3473bf9360
Move sudo_mode into struct sudoers_context.
2023-08-21 10:47:23 -06:00
Todd C. Miller
837da1bef0
Move NewArgv, NewArgc and saved_argv into struct sudoers_context.
2023-08-21 09:22:24 -06:00
Todd C. Miller
87571dab0a
Add struct sudoers_conf to struct sudoers_plugin_context.
...
There's now no need to pass this directly to init_parser() since we
already pass in a pointer to a sudoers_context struct.
2023-08-21 09:21:54 -06:00
Todd C. Miller
9e53d903ea
Store policy paths in struct sudoers_context.
...
This removes the need for the getters in policy.c.
2023-08-21 09:21:53 -06:00
Todd C. Miller
bbaf293912
Add sudoers_ctx_free() and use it for freeing struct sudoers context.
...
This replaces sudoers_user_ctx_free() and sudoers_runas_ctx_free().
2023-08-21 09:21:52 -06:00
Todd C. Miller
2440174954
Make struct sudoers_context private to sudoers.c.
...
We now pass a pointer to the context where necessary. There are a
few cases where we need to request the context from sudoers via
sudoers_get_context() for the plugin API functions. If the plugin
API was able to pass around a closure pointer this would not be
necessary.
2023-08-21 09:21:49 -06:00
Todd C. Miller
2d2529a15e
Add a sudoers_context struct that embeds the user and runas structs.
2023-08-20 16:27:08 -06:00
Todd C. Miller
20baa39007
Move max_groups out of sudoers_user_context and into pwutil.c.
...
It is only used by the local password pwutil implementation.
2023-08-14 16:29:15 -06:00
Todd C. Miller
737354390c
Pass in directory to check_user_runchroot() and check_user_runcwd().
...
This way we do not rely on the runas_ctx global.
2023-08-14 13:25:13 -06:00
Todd C. Miller
08afb5183f
Move RUNAS_{USER,GROUP}_SPECIFIED flags into struct sudoers_runas_context.
2023-08-14 09:01:39 -06:00
Todd C. Miller
392f0d61cb
Make path_plugin_dir private to policy.c and add getter.
2023-08-13 17:05:00 -06:00
Todd C. Miller
217b7b46f3
Move list_pw global into struct runas_context.
2023-08-13 09:34:57 -06:00
Todd C. Miller
a321e6cedf
Add struct sudoers_runas_context and move runas-specific bits into it.
2023-08-12 14:20:30 -06:00
Todd C. Miller
d8b28dad97
Expand the user_* (and more) macros to user_ctx.foo.
2023-08-12 10:39:59 -06:00
Todd C. Miller
30c49288f7
Make sudoers_user_ctx_free() private to sudoers.c
2023-08-12 10:39:48 -06:00
Todd C. Miller
bd8cccb5dd
Rename struct sudo_user -> struct sudo_user_context.
...
Also rename the sudo_user global to user_ctx.
2023-08-12 10:39:47 -06:00
Todd C. Miller
603148e7f2
Move sudoers parser callbacks to callbacks.c.
2023-08-10 15:49:30 -06:00
Todd C. Miller
e178b85821
Store the source of the matching rule and store in the event log.
...
The JSON logs will store the matching rule source.
2023-08-08 09:57:09 -06:00
Todd C. Miller
cbcb1d2506
sudoers plugin: make more bit flags unsigned.
2023-07-10 11:06:23 -06:00
Todd C. Miller
01ad570e24
Move check_user_* functions to check_util.c so testsudoers can use them.
2023-06-30 10:43:18 -06:00
Todd C. Miller
f352ef5d67
Move parser prototypes / externs from sudoers.h to parse.h or toke.h.
2023-05-09 14:01:41 -06:00
Todd C. Miller
8cbd5462a6
Move sudoers search path to struct sudoers_parser_config.
...
That way we can avoid passing it to init_parser() directly.
We still need sudoers_search_path to be shared between the lexer
and the parser.
2023-05-08 17:04:38 -06:00
Todd C. Miller
9d7c30c5a8
Add struct sudoers_parser_config and pass it to init_parser().
...
This struct contains parser configuration such as the sudoers file
uid/gid/mode and parse flags such as verbose, strict and recovery.
2023-05-08 17:03:31 -06:00
Todd C. Miller
c0fa3a4d24
Rename force_umask to override_umask and make it private to sudoers.c.
...
Add getter for policy.c.
2023-05-04 13:46:20 -06:00