/*
 * call-seq:
 *   set_password(new_password)
 *
 * Call krb5_set_password to set the password for this credential to new_password.  This requires that the credentials have already been fetched via Krb5.get_init_creds_password or Krb5.get_init_creds_keytab.  Returns true on success, raises Krb5Auth::Krb5::Exception on failure.
 */
static VALUE Krb5_change_password(VALUE self, VALUE _newpass)
{
  Check_Type(_newpass,T_STRING);
  char *newpass = STR2CSTR(_newpass);

  struct ruby_krb5 *kerb;
  krb5_error_code krbret;
  int pw_result;
  krb5_data pw_res_string, res_string;

  Data_Get_Struct(self, struct ruby_krb5, kerb);
  if (!kerb) {
    NOSTRUCT_EXCEPT();
    return Qfalse;
  }

  krbret = krb5_set_password(kerb->ctx, &kerb->creds, newpass, NULL,
                             &pw_result, &pw_res_string, &res_string );
  if (krbret) {
    Krb5_register_error(krbret);
    return Qfalse;
  }

  return Qtrue;
}