summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnas Nashif <nashif@intel.com>2007-05-14 05:23:41 +0000
committerAnas Nashif <nashif@intel.com>2007-05-14 05:23:41 +0000
commit74dc56b3895b598b8dc1056319d3966b58af9596 (patch)
treecd8189d67d913adc36a73992be35edf60bfe7102 /src
parent4331107410d9546764581ffb02b5bb8956b2451b (diff)
downloadwsmancli-74dc56b3895b598b8dc1056319d3966b58af9596.tar.gz
wsmancli-74dc56b3895b598b8dc1056319d3966b58af9596.tar.xz
wsmancli-74dc56b3895b598b8dc1056319d3966b58af9596.zip
move command line user/pw request to client
Diffstat (limited to 'src')
-rw-r--r--src/wsman.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/wsman.c b/src/wsman.c
index 145ddf7..c026f16 100644
--- a/src/wsman.c
+++ b/src/wsman.c
@@ -91,6 +91,37 @@ static void initialize_logging(void)
+static void
+request_usr_pwd( wsman_auth_type_t auth,
+ char **username,
+ char **password)
+{
+ char *pw;
+ char user[21];
+ char *p;
+
+ fprintf(stdout,"Authentication failed, please retry\n");
+ /*
+ fprintf(stdout, "%s authentication is used\n",
+ wsman_client_transport_get_auth_name( auth));
+ */
+ printf("User name: ");
+ fflush(stdout);
+ if ( (p = fgets(user, 20, stdin) ) != NULL )
+ {
+
+ if (strchr(user, '\n'))
+ (*(strchr(user, '\n'))) = '\0';
+ *username = u_strdup_printf ("%s", user);
+ } else {
+ *username = NULL;
+ }
+
+ pw = (char *)getpass("Password: ");
+ *password = u_strdup_printf ("%s", pw);
+}
+
+
int main(int argc, char **argv)
{
int retVal = 0;
@@ -139,6 +170,7 @@ int main(int argc, char **argv)
"http", wsman_options_get_username(),
wsman_options_get_password());
+ wsman_client_transport_set_auth_request_func(cl , &request_usr_pwd );
if (cl == NULL) {
@@ -172,7 +204,7 @@ int main(int argc, char **argv)
options);
wsman_remove_query_string(resource_uri_with_selectors,
&resource_uri);
- } else {
+ } else if (resource_uri_with_selectors) {
wsman_remove_query_string(resource_uri_with_selectors,
&resource_uri);
}