1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-04 22:33:27 +00:00
freebsd-ports/security/krb5-16/files/patch-as

143 lines
4.1 KiB
Plaintext
Raw Normal View History

2000-01-16 19:10:58 +00:00
--- clients/ksu/main.c.ORIG Fri Dec 17 14:44:39 1999
+++ clients/ksu/main.c Fri Dec 17 18:52:57 1999
2000-06-24 01:48:11 +00:00
@@ -60,6 +60,6 @@
2000-01-16 19:10:58 +00:00
ill specified arguments to commands */
void usage (){
- fprintf(stderr, "Usage: %s [target user] [-n principal] [-c source cachename] [-C target cachename] [-k] [-D] [-r time] [-pf] [-l lifetime] [-zZ] [-q] [-e command [args... ] ] [-a [args... ] ]\n", prog_name);
+ fprintf(stderr, "Usage: %s [target user] [-m] [-n principal] [-c source cachename] [-C target cachename] [-k] [-D] [-r time] [-pf] [-l lifetime] [-zZ] [-q] [-e command [args... ] ] [-a [args... ] ]\n", prog_name);
}
2000-06-24 01:48:11 +00:00
@@ -76,6 +76,7 @@
2000-01-16 19:10:58 +00:00
int argc;
char ** argv;
{
+int asme = 0;
int hp =0;
int some_rest_copy = 0;
int all_rest_copy = 0;
@@ -90,6 +91,7 @@
char * cc_target_tag = NULL;
char * target_user = NULL;
char * source_user;
+char * source_shell;
krb5_ccache cc_source = NULL;
const char * cc_source_tag = NULL;
2000-06-24 01:48:11 +00:00
@@ -183,5 +185,5 @@
2000-01-16 19:10:58 +00:00
}
- while(!done && ((option = getopt(pargc, pargv,"n:c:r:a:zZDfpkql:e:")) != -1)){
+ while(!done && ((option = getopt(pargc, pargv,"n:c:r:a:zZDfpkmql:e:")) != -1)){
switch (option) {
case 'r':
options.opt |= KDC_OPT_RENEWABLE;
2000-06-24 01:48:11 +00:00
@@ -227,6 +229,9 @@
2000-01-16 19:10:58 +00:00
errflg++;
}
break;
+ case 'm':
+ asme = 1;
+ break;
case 'n':
if ((retval = krb5_parse_name(ksu_context, optarg, &client))){
com_err(prog_name, retval, "when parsing name %s", optarg);
2000-06-24 01:48:11 +00:00
@@ -341,6 +341,7 @@
2000-01-16 19:10:58 +00:00
/* allocate space and copy the usernamane there */
source_user = xstrdup(pwd->pw_name);
+ source_shell = xstrdup(pwd->pw_shell);
source_uid = pwd->pw_uid;
source_gid = pwd->pw_gid;
2000-06-24 01:48:11 +00:00
@@ -669,44 +675,61 @@
2000-01-16 19:10:58 +00:00
/* get the shell of the user, this will be the shell used by su */
2000-06-24 01:48:11 +00:00
2000-01-16 19:10:58 +00:00
target_pwd = getpwnam(target_user);
- if (target_pwd->pw_shell)
- shell = xstrdup(target_pwd->pw_shell);
- else {
- shell = _DEF_CSH; /* default is cshell */
- }
+ if (asme) {
+ if (source_shell && *source_shell) {
+ shell = strdup(source_shell);
+ } else {
+ shell = _DEF_CSH;
+ }
+ } else {
+ if (target_pwd->pw_shell)
+ shell = strdup(target_pwd->pw_shell);
+ else {
+ shell = _DEF_CSH; /* default is cshell */
+ }
+ }
#ifdef HAVE_GETUSERSHELL
/* insist that the target login uses a standard shell (root is omited) */
- if (!standard_shell(target_pwd->pw_shell) && source_uid) {
- fprintf(stderr, "ksu: permission denied (shell).\n");
2000-06-24 01:48:11 +00:00
- sweep_up(ksu_context, cc_target);
2000-01-16 19:10:58 +00:00
- exit(1);
+ if (asme) {
+ if (!standard_shell(pwd->pw_shell) && source_uid) {
+ fprintf(stderr, "ksu: permission denied (shell).\n");
2000-06-24 01:48:11 +00:00
+ sweep_up(ksu_context, cc_target);
2000-01-16 19:10:58 +00:00
+ exit(1);
+ }
+ } else {
+ if (!standard_shell(target_pwd->pw_shell) && source_uid) {
+ fprintf(stderr, "ksu: permission denied (shell).\n");
2000-06-24 01:48:11 +00:00
+ sweep_up(ksu_context, cc_target);
2000-01-16 19:10:58 +00:00
+ exit(1);
+ }
}
#endif /* HAVE_GETUSERSHELL */
- if (target_pwd->pw_uid){
-
- if(set_env_var("USER", target_pwd->pw_name)){
- fprintf(stderr,"ksu: couldn't set environment variable USER\n");
2000-06-24 01:48:11 +00:00
- sweep_up(ksu_context, cc_target);
2000-01-16 19:10:58 +00:00
- exit(1);
- }
- }
-
- if(set_env_var( "HOME", target_pwd->pw_dir)){
- fprintf(stderr,"ksu: couldn't set environment variable USER\n");
2000-06-24 01:48:11 +00:00
- sweep_up(ksu_context, cc_target);
2000-01-16 19:10:58 +00:00
- exit(1);
- }
-
- if(set_env_var( "SHELL", shell)){
- fprintf(stderr,"ksu: couldn't set environment variable USER\n");
2000-06-24 01:48:11 +00:00
- sweep_up(ksu_context, cc_target);
2000-01-16 19:10:58 +00:00
- exit(1);
- }
+ if (!asme) {
+ if (target_pwd->pw_uid){
+ if (set_env_var("USER", target_pwd->pw_name)){
+ fprintf(stderr,"ksu: couldn't set environment variable USER\n");
2000-06-24 01:48:11 +00:00
+ sweep_up(ksu_context, cc_target);
2000-01-16 19:10:58 +00:00
+ exit(1);
+ }
+ }
+
+ if (set_env_var( "HOME", target_pwd->pw_dir)){
+ fprintf(stderr,"ksu: couldn't set environment variable USER\n");
2000-06-24 01:48:11 +00:00
+ sweep_up(ksu_context, cc_target);
2000-01-16 19:10:58 +00:00
+ exit(1);
+ }
+
+ if (set_env_var( "SHELL", shell)){
+ fprintf(stderr,"ksu: couldn't set environment variable USER\n");
2000-06-24 01:48:11 +00:00
+ sweep_up(ksu_context, cc_target);
2000-01-16 19:10:58 +00:00
+ exit(1);
+ }
+ }
/* set the cc env name to target */