Skip to content

Commit

Permalink
Mostly output formatting fixes.
Browse files Browse the repository at this point in the history
Also, rather than figuring out the default host key, leave it to the library.


git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7787 dc483132-0cff-0310-8789-dd5450dbe970
  • Loading branch information
probe committed Apr 11, 1996
1 parent 2377022 commit e3122e9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
6 changes: 6 additions & 0 deletions src/clients/ksu/ChangeLog
@@ -1,3 +1,9 @@
Wed Apr 10 20:24:49 1996 Richard Basch <basch@lehman.com>

* main.c, krb_auth_su.c: Mostly cosmetic cleanup of output
statements. Also, rather than computing the default host key,
let the library routine do it.

Wed Mar 13 17:45:11 1996 Ken Raeburn <raeburn@cygnus.com>

* configure.in: Use AC_HEADER_STDARG.
Expand Down
13 changes: 7 additions & 6 deletions src/clients/ksu/krb_auth_su.c
Expand Up @@ -102,7 +102,7 @@ krb5_boolean zero_password;
*/
if( krb5_fast_auth(context, client, server, target_user, cc) == TRUE){
if (auth_debug ){
fprintf (stderr,"Athenticated via fast_auth \n");
fprintf (stderr,"Authenticated via fast_auth \n");
}
return TRUE;
}
Expand Down Expand Up @@ -202,11 +202,12 @@ krb5_boolean zero_password;
krb5_free_tgt_creds(context, tgts);
}

if ((retval = krb5_verify_tkt_def(context, client, server,
&out_creds->keyblock,
&out_creds->ticket, &target_tkt))){
com_err(prog_name, retval, "while verifing ticket for server");
return (FALSE);
retval = krb5_verify_tkt_def(context, client, server,
&out_creds->keyblock, &out_creds->ticket,
&target_tkt);
if (retval) {
com_err(prog_name, retval, "while verifying ticket for server");
if (retval != ENOENT) return (FALSE);
}

if ((retval = krb5_cc_store_cred(context, cc, out_creds))){
Expand Down
48 changes: 21 additions & 27 deletions src/clients/ksu/main.c
Expand Up @@ -56,7 +56,7 @@ char * get_dir_of_file();
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] [-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);

}

Expand All @@ -75,7 +75,7 @@ main (argc, argv)
int hp =0;
int some_rest_copy = 0;
int all_rest_copy = 0;
char localhostname [MAXHOSTNAMELEN];
char *localhostname = NULL;
opt_info options;
int option=0;
int statusp=0;
Expand Down Expand Up @@ -181,13 +181,13 @@ char * dir_of_cc_source;
/* when integrating this remember to pass in pargc, pargv and
take care of params argument */
optind --;
if (auth_debug){printf("Before get_params optind=%d \n", optind);}
if (auth_debug){printf("Before get_params optind=%d\n", optind);}

if ((retval = get_params( & optind, pargc, pargv, &params))){
com_err(prog_name, retval, "when gathering parameters");
errflg++;
}
if(auth_debug){ printf("After get_params optind=%d \n", optind);}
if(auth_debug){ printf("After get_params optind=%d\n", optind);}
done = 1;
break;
case 'p':
Expand Down Expand Up @@ -225,15 +225,15 @@ char * dir_of_cc_source;
some_rest_copy = 1;
if(all_rest_copy || use_source_cache){
fprintf(stderr,
"-z option is mutually exclusive with -Z and -C . \n");
"-z option is mutually exclusive with -Z and -C .\n");
errflg++;
}
break;
case 'Z':
all_rest_copy = 1;
if(some_rest_copy || use_source_cache){
fprintf(stderr,
"-Z option is mutually exclusive with -z and -C . \n");
"-Z option is mutually exclusive with -z and -C .\n");
errflg++;
}
break;
Expand All @@ -254,7 +254,7 @@ char * dir_of_cc_source;
if ( strchr(cc_target_tag, ':')){
cc_target_tag_tmp=strchr(cc_target_tag,':') + 1;
if(!stat(cc_target_tag_tmp, &st_temp )){
fprintf(stderr,"File %s exists \n",
fprintf(stderr,"File %s exists\n",
cc_target_tag_tmp);
errflg++;
}
Expand All @@ -278,7 +278,7 @@ char * dir_of_cc_source;
cc_source_tag_tmp = strchr(cc_source_tag, ':') + 1;

if( stat( cc_source_tag_tmp, &st_temp)){
fprintf(stderr,"File %s does not exist \n",
fprintf(stderr,"File %s does not exist\n",
cc_source_tag_tmp);
errflg++;

Expand All @@ -297,12 +297,12 @@ char * dir_of_cc_source;
break;
case 'e':
cmd = strdup(optarg);
if(auth_debug){printf("Before get_params optind=%d \n", optind);}
if(auth_debug){printf("Before get_params optind=%d\n", optind);}
if ((retval = get_params( & optind, pargc, pargv, &params))){
com_err(prog_name, retval, "when gathering parameters");
errflg++;
}
if(auth_debug){printf("After get_params optind=%d \n", optind);}
if(auth_debug){printf("After get_params optind=%d\n", optind);}
done = 1;

if (auth_debug){
Expand Down Expand Up @@ -367,11 +367,6 @@ char * dir_of_cc_source;

init_auth_names(target_pwd->pw_dir);

if (gethostname (localhostname, MAXHOSTNAMELEN)){
fprintf (stderr, " failed to get localhostname\n");
exit(1);
}

/***********************************/

if (cc_source_tag == NULL){
Expand Down Expand Up @@ -412,7 +407,7 @@ char * dir_of_cc_source;
exit(1);
}

if ( stat(cc_source_tag_tmp, &st_temp)){
if (stat(cc_source_tag_tmp, &st_temp)){
if (use_source_cache){

dir_of_cc_source = get_dir_of_file(cc_source_tag_tmp);
Expand Down Expand Up @@ -482,8 +477,8 @@ char * dir_of_cc_source;

if ((source_uid == 0) && (target_uid != 0)) {

if ((retval =krb5_ccache_copy_restricted(ksu_context, cc_source,
cc_target_tag,client,&cc_target, &stored))){
if ((retval = krb5_ccache_copy_restricted(ksu_context, cc_source,
cc_target_tag, client, &cc_target, &stored))){
com_err (prog_name, retval,
"while copying cache %s to %s",
krb5_cc_get_name(ksu_context, cc_source),cc_target_tag);
Expand Down Expand Up @@ -528,7 +523,7 @@ char * dir_of_cc_source;
exit(1);
}

fprintf(stderr,"WARNING: Your password may be exposed if you enter it here and are logged \n");
fprintf(stderr,"WARNING: Your password may be exposed if you enter it here and are logged\n");
fprintf(stderr," in remotely using an unsecure (non-encrypted) channel.\n");
if (krb5_get_tkt_via_passwd (ksu_context, &cc_target, client,
kdc_server, &options,
Expand Down Expand Up @@ -560,7 +555,6 @@ char * dir_of_cc_source;
auth_val = krb5_auth_check(ksu_context, client, localhostname, &options,
target_user,cc_target, &path_passwd);


/* if kerbereros authentication failed then exit */
if (auth_val ==FALSE){
fprintf(stderr, "Authentication failed.\n");
Expand Down Expand Up @@ -635,18 +629,18 @@ char * dir_of_cc_source;
syslog(LOG_WARNING, "%s",exec_cmd);
}
fprintf(stderr,
"Account %s: authorization for %s for execution of %s failed \n",
"Account %s: authorization for %s for execution of %s failed\n",
target_user, client_name, cmd );
syslog(LOG_WARNING,
"Account %s: authorization for %s for execution of %s failed \n",
"Account %s: authorization for %s for execution of %s failed",
target_user, client_name, cmd );

}else{
fprintf(stderr,
"Account %s: authorization of %s failed \n",
"Account %s: authorization of %s failed\n",
target_user, client_name);
syslog(LOG_WARNING,
"Account %s: authorization of %s failed \n",
"Account %s: authorization of %s failed",
target_user, client_name);

}
Expand Down Expand Up @@ -717,7 +711,7 @@ char * dir_of_cc_source;
/* set the cc env name to target */

if(set_env_var( KRB5_ENV_CCNAME, cc_target_tag)){
fprintf(stderr,"ksu: couldn't set environment variable %s \n",
fprintf(stderr,"ksu: couldn't set environment variable %s\n",
KRB5_ENV_CCNAME);
sweep_up(ksu_context, use_source_cache, cc_target);
exit(1);
Expand Down Expand Up @@ -804,8 +798,8 @@ char * dir_of_cc_source;
switch ((child_pid = fork())) {
default:
if (auth_debug){
printf(" The childs pid is %d \n", child_pid);
printf(" The parents pid is %d \n", getpid());
printf(" The child pid is %d\n", child_pid);
printf(" The parent pid is %d\n", getpid());
}
while ((ret_pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) {
if (WIFSTOPPED(statusp)) {
Expand Down

0 comments on commit e3122e9

Please sign in to comment.