krb5_get_init_creds_password code question

Scott T. scottt35 at hotmail.com
Wed Apr 2 16:48:50 EST 2003


In the following code segment, pw1 and chpw_cred are never used. What gives? -Scott

KRB5_DLLIMP krb5_error_code KRB5_CALLCONV
krb5_get_init_creds_password(context, creds, client, password, prompter, data,
			     start_time, in_tkt_service, options)
     krb5_context context;
     krb5_creds *creds;
     krb5_principal client;
     char *password;
     krb5_prompter_fct prompter;
     void *data;
     krb5_deltat start_time;
     char *in_tkt_service;
     krb5_get_init_creds_opt *options;
{
   krb5_error_code ret;
   int use_master;
   krb5_kdc_rep *as_reply;
   krb5_creds chpw_creds;
   krb5_get_init_creds_opt;
   krb5_data pw0, pw1;
   char pw0array[1024], pw1array[1024];

   use_master = 0;
   as_reply = NULL;
   memset(&chpw_creds, 0, sizeof(chpw_creds));

   pw0.data = pw0array;

   if (password) {
      if ((pw0.length = strlen(password)) > sizeof(pw0array)) {
	 ret = EINVAL;
	 goto cleanup;
      }
      strcpy(pw0.data, password);
   } else {
      pw0.data[0] = '\0';
      pw0.length = sizeof(pw0array);
   }

   pw1.data = pw1array;
   pw1.data[0] = '\0';
   pw1.length = sizeof(pw1array);

   /* first try: get the requested tkt from any kdc */
   ret = krb5_get_init_creds(context, creds, client, prompter, data,
			     start_time, in_tkt_service, options,
			     krb5_get_as_key_password, (void *) &pw0,
			     use_master, &as_reply);

cleanup:
   memset(pw0array, 0, sizeof(pw0array));
   memset(pw1array, 0, sizeof(pw1array));
   krb5_free_cred_contents(context, &chpw_creds);
   if (as_reply)
      krb5_free_kdc_rep(context, as_reply);

   return(ret);
}


More information about the Kerberos mailing list