+ inform("unknown credentials style %s, continuing...", cred_style);
+ return NULL;
+ }
+
+ ruserpass(creds->host, &creds->user, &creds->pass,
+ RUSERPASS_NO_PROMPT_USER | RUSERPASS_NO_PROMPT_PASSWORD);
+
+ return creds;
+}
+
+/*
+ * Retrieve the username
+ */
+
+const char *
+nmh_cred_get_user(nmh_creds_t creds)
+{
+ if (! creds->user) {
+ ruserpass(creds->host, &creds->user, &creds->pass,
+ RUSERPASS_NO_PROMPT_PASSWORD);
+ }
+
+ return creds->user;
+}
+
+/*
+ * Retrieve the password
+ */
+
+const char *
+nmh_cred_get_password(nmh_creds_t creds)
+{
+ if (! creds->pass) {
+ ruserpass(creds->host, &creds->user, &creds->pass, 0);
+ }
+
+ return creds->pass;
+}
+
+/*
+ * Free our credentials
+ */
+
+void
+nmh_credentials_free(nmh_creds_t creds)
+{
+ free(creds->host);
+ free(creds->user);
+
+ if (creds->pass) {
+ memset(creds->pass, 0, strlen(creds->pass));
+ free(creds->pass);