if ((pwd = getpwnam(luser)) == NULL)
return 0;
- if (retval = krb5_unparse_name(context, principal, &princname))
+ retval = krb5_unparse_name(context, principal, &princname);
+ if (retval)
return retval;
#ifdef DEBUG
fprintf(stderr,
"In krb5_authorization: principal to be authorized %s\n",
princname);
- if (retval = k5login_lookup( login_fp, princname, &retbool)){
+
+ retval = k5login_lookup(login_fp, princname, &retbool);
+ if (retval) {
auth_cleanup(users_fp, login_fp, princname);
return retval;
}
}
if ((!k5users_flag) && (retbool == FALSE) ){
- if(retval = k5users_lookup (users_fp, princname,
- cmd, &retbool, out_fcmd)){
+ retval = k5users_lookup (users_fp, princname,
+ cmd, &retbool, out_fcmd);
+ if(retval) {
auth_cleanup(users_fp, login_fp, princname);
return retval;
}
char * lp;
krb5_boolean loc_found = FALSE;
-
- if (retval = get_line(fp, &line )){
+ retval = get_line(fp, &line);
+ if (retval)
return retval;
- }
while (line){
fprinc = get_first_token (line, &lp);
}
free (line);
- if (retval = get_line(fp, &line )){ return retval;}
+
+ retval = get_line(fp, &line);
+ if (retval)
+ return retval;
}
char * loc_fcmd = NULL;
krb5_boolean loc_found = FALSE;
- if (retval = get_line(fp, &line ))
+ retval = get_line(fp, &line);
+ if (retval)
return retval;
while (line){
}
}
- }while (fcmd = get_next_token( &lp));
+ }while ((fcmd = get_next_token( &lp)));
}
free (line);
break;
}
free (line);
- if (retval = get_line(fp, &line )){ return retval;}
+
+ retval = get_line(fp, &line);
+ if (retval) {
+ return retval;
+ }
}
*out_fcmd = loc_fcmd;
i++;
- } while(tc = get_next_token (&lp));
+ } while((tc = get_next_token (&lp)));
tmp_fcmd[i] = NULL;
*out_fcmd = tmp_fcmd;
line[0] = '\0';
while (( r = fgets(line_ptr, BUFSIZ , fp)) != NULL){
- if (newline = strchr(line_ptr, '\n')){
+ newline = strchr(line_ptr, '\n');
+ if (newline) {
*newline = '\0';
break;
}
if (!(temp_list = (char **) malloc( CHUNK * sizeof(char *))))
return errno;
- if (retval = get_line(fp, &line ))
+ retval = get_line(fp, &line);
+ if (retval)
return retval;
while (line){
free (line);
- if (retval = get_line(fp, &line )){ return retval;}
+ retval = get_line(fp, &line);
+ if (retval)
+ return retval;
}
temp_list[count] = NULL;
while(k5users_list[i]){
- if (retval= k5users_lookup(fp, k5users_list[i], cmd, &found, &out_cmd))
+ retval= k5users_lookup(fp, k5users_list[i], cmd, &found, &out_cmd);
+ if (retval)
return retval;
if (found == FALSE){
return 0;
}
- if(retval = get_all_princ_from_file (users_fp, &k5users_list)){
+ retval = get_all_princ_from_file (users_fp, &k5users_list);
+ if(retval) {
close_time(k5users_flag,users_fp, k5login_flag,login_fp);
return retval;
}
rewind(users_fp);
- if(retval = filter(users_fp,cmd, k5users_list, &k5users_filt_list)){
+ retval = filter(users_fp,cmd, k5users_list, &k5users_filt_list);
+ if(retval) {
close_time(k5users_flag,users_fp, k5login_flag, login_fp);
return retval;
}
}
if (!k5login_flag){
- if(retval = get_all_princ_from_file (login_fp, &k5login_list)){
+ retval = get_all_princ_from_file (login_fp, &k5login_list);
+ if(retval) {
close_time(k5users_flag,users_fp, k5login_flag,login_fp);
return retval;
}
close_time(k5users_flag,users_fp, k5login_flag, login_fp);
if (cmd) {
- if (retval = list_union(k5login_list,
- k5users_filt_list, &combined_list)){
- close_time(k5users_flag,users_fp, k5login_flag,login_fp);
- return retval;
- }
- *princ_list = combined_list;
- return 0;
+ retval = list_union(k5login_list, k5users_filt_list, &combined_list);
+ if (retval){
+ close_time(k5users_flag,users_fp, k5login_flag,login_fp);
+ return retval;
+ }
+ *princ_list = combined_list;
+ return 0;
} else {
if (k5users_filt_list != NULL)
free(k5users_filt_list);
while(plist[i]){
- if (retval = krb5_parse_name(context, plist[i], &temp_client))
+ retval = krb5_parse_name(context, plist[i], &temp_client);
+ if (retval)
return retval;
-
+
pnelem = krb5_princ_size(context, temp_client);
-
+
if ( cnelem > pnelem){
i++;
continue;
}
-
+
if (krb5_princ_realm(context, *client)->length ==
krb5_princ_realm(context, temp_client)->length
&& (!memcmp (krb5_princ_realm(context, *client)->data,
krb5_princ_realm(context, temp_client)->data,
krb5_princ_realm(context, temp_client)->length))){
-
+
got_one = TRUE;
for(j =0; j < cnelem; j ++){
krb5_data *p1 =
krb5_princ_component(context, *client, j);
krb5_data *p2 =
krb5_princ_component(context, temp_client, j);
-
+
if ((p1->length != p2->length) ||
memcmp(p1->data,p2->data,p1->length)){
got_one = FALSE;
}
i++;
}
-
+
if (best_client) {
*found = TRUE;
*client = best_client;
if ( ! stat(cc_source_name, &st_temp)){
- if (retval = find_ticket(context, cc, client, end_server, &temp_found))
+ retval = find_ticket(context, cc, client, end_server, &temp_found);
+ if (retval)
return retval;
if (temp_found == FALSE){
- if (retval = krb5_tgtname(context,
- krb5_princ_realm(context, client),
- krb5_princ_realm(context, client),
- &kdc_server)){
- return retval ;
- }
+ retval = krb5_tgtname(context,
+ krb5_princ_realm(context, client),
+ krb5_princ_realm(context, client),
+ &kdc_server);
+ if (retval)
+ return retval;
- if(retval = find_ticket(context, cc,client, kdc_server, &temp_found))
+ retval = find_ticket(context, cc,client, kdc_server, &temp_found);
+ if(retval)
return retval;
}
else if (auth_debug)
memset((char *) &tgtq, 0, sizeof(tgtq));
memset((char *) &tgt, 0, sizeof(tgt));
- if (retval= krb5_copy_principal(context, client, &tgtq.client))
+ retval= krb5_copy_principal(context, client, &tgtq.client);
+ if (retval)
return retval;
- if (retval= krb5_copy_principal(context, server, &tgtq.server))
+ retval= krb5_copy_principal(context, server, &tgtq.server);
+ if (retval)
return retval ;
retval = krb5_cc_retrieve_cred(context, cc, KRB5_TC_MATCH_SRV_NAMEONLY | KRB5_TC_SUPPORTED_KTYPES,
if (!plist) return 0;
- if (retval = krb5_unparse_name(context, princ, &princname))
+ retval = krb5_unparse_name(context, princ, &princname);
+ if (retval)
return retval;
while (plist[i] ){
cc_source_name = krb5_cc_get_name(context, cc_source);
- if (! stat(cc_source_name, &st_temp))
- if (retval = krb5_cc_get_principal(context, cc_source, &cc_def_princ))
+ if (! stat(cc_source_name, &st_temp)) {
+ retval = krb5_cc_get_principal(context, cc_source, &cc_def_princ);
+ if (retval)
return retval;
+ }
-
- if (retval=krb5_parse_name(context, target_user, &target_client))
+ retval=krb5_parse_name(context, target_user, &target_client);
+ if (retval)
return retval;
- if (retval=krb5_parse_name(context, source_user, &source_client))
+
+ retval=krb5_parse_name(context, source_user, &source_client);
+ if (retval)
return retval;
if (source_uid == 0){
return 0;
}else{
- if (retval = get_authorized_princ_names(target_user, cmd, &aplist))
+ retval = get_authorized_princ_names(target_user, cmd, &aplist);
+ if (retval)
return retval;
/* .k5users or .k5login exist, but no authorization */
}
}
- if (retval = krb5_sname_to_principal(context, hostname, NULL,
- KRB5_NT_SRV_HST, &end_server))
+ retval = krb5_sname_to_principal(context, hostname, NULL,
+ KRB5_NT_SRV_HST, &end_server);
+ if (retval)
return retval;
for (i= 0; i < count; i ++){
if(princ_trials[i].p) {
- if (retval= find_princ_in_list(context, princ_trials[i].p, aplist, &found))
+ retval= find_princ_in_list(context, princ_trials[i].p, aplist,
+ &found);
+ if (retval)
return retval;
if (found == TRUE){
princ_trials[i].found = TRUE;
- if (retval = find_either_ticket (context, cc_source,
- princ_trials[i].p,
- end_server, &found))
+ retval = find_either_ticket (context, cc_source,
+ princ_trials[i].p,
+ end_server, &found);
+ if (retval)
return retval;
if (found == TRUE){
*client = princ_trials[i].p;
i=0;
while (aplist[i]){
-
- if (retval = krb5_parse_name(context, aplist[i], &temp_client))
+ retval = krb5_parse_name(context, aplist[i], &temp_client);
+ if (retval)
return retval;
- if (retval = find_either_ticket (context, cc_source, temp_client,
- end_server, &found))
+ retval = find_either_ticket (context, cc_source, temp_client,
+ end_server, &found);
+ if (retval)
return retval;
if (found == TRUE){
#ifdef PRINC_LOOK_AHEAD
for (i=0; i < count; i ++){
if (princ_trials[i].p){
- if(retval=krb5_copy_principal(context, princ_trials[i].p,
- &temp_client))
+ retval=krb5_copy_principal(context, princ_trials[i].p,
+ &temp_client);
+ if(retval)
return retval;
/* get the client name that is the closest
to the three princ in trials */
- if(retval=get_closest_principal(context, aplist, &temp_client, & found))
+ retval=get_closest_principal(context, aplist, &temp_client,
+ &found);
+ if(retval)
return retval;
if (found == TRUE){