Compare commits

...
Sign in to create a new pull request.

10 commits

Author SHA1 Message Date
Fedora Release Engineering
443e99b696 Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild 2026-07-17 08:57:06 +00:00
Fedora Release Engineering
52b7df0dcb Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild 2026-01-17 20:23:27 +00:00
Fedora Release Engineering
1452dc236e Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-25 20:33:55 +00:00
Vitezslav Crhonek
7c71218baa Update to wsmancli-2.8.0 2025-04-08 10:27:03 +02:00
Fedora Release Engineering
1e5f4c387b Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-19 15:17:56 +00:00
Fedora Release Engineering
3f0c579f23 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-20 09:35:22 +00:00
Fedora Release Engineering
622803c140 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-27 09:11:47 +00:00
Fedora Release Engineering
0d0716942e Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-22 18:25:27 +00:00
Vitezslav Crhonek
cc8bdd3218 Update to wsmancli-2.6.2 2023-05-19 08:51:27 +02:00
Vitezslav Crhonek
bc6857af64 SPDX migration 2023-04-25 12:30:16 +02:00
5 changed files with 36 additions and 204 deletions

8
.gitignore vendored
View file

@ -1,7 +1 @@
wsmancli-2.2.3.tar.bz2
/wsmancli-2.2.4.tar.bz2
/wsmancli-2.2.5.tar.bz2
/wsmancli-2.2.7.1.tar.bz2
/wsmancli-2.3.0.tar.bz2
/v2.3.1.tar.gz
/wsmancli-2.6.0.tar.gz
/wsmancli-2.8.0.tar.gz

View file

@ -1,127 +0,0 @@
diff -up wsmancli-2.6.0/src/wsman.c.orig wsmancli-2.6.0/src/wsman.c
--- wsmancli-2.6.0/src/wsman.c.orig 2015-06-11 10:50:04.000000000 +0200
+++ wsmancli-2.6.0/src/wsman.c 2022-07-19 09:09:48.518951546 +0200
@@ -63,7 +63,11 @@ static char *cert = NULL;
static char *sslkey = NULL;
static char *endpoint = NULL;
static char *username = NULL;
+static char *username_given = NULL; /* copy of either the username from env or cmdline*/
+static char *username_prev = NULL; /* input username to request_usr_pwd() when called last time */
static char *password = NULL;
+static char *password_given = NULL; /* copy of either the password from env or cmdline */
+static char *password_prev = NULL; /* input password to request_usr_pwd() when called last time */
static char *server = "localhost";
static char *agent = NULL;
static char *url_path = NULL;
@@ -495,28 +499,79 @@ request_usr_pwd( WsManClient *client, ws
char user[21];
char *p;
- fprintf(stdout,"Authentication failed, please retry\n");
- /*
- fprintf(stdout, "%s authentication is used\n",
- wsmc_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;
+ /*
+ * fprintf(stdout,"Authentication failed, please retry\n");
+ *
+ * this message shall not be printed by this function as it cannot decide on the
+ * reason it was called for. It does not control the authentication process.
+ * wsmc_handler is better suited for such a decision making.
+ */
+
+ if (username_given) {
+ if (password_given) {
+ /* Initially provided combination of password and username is not valid.
+ * Request user to type both. Here I assume, that wsmc_handler called back to
+ * this function after trying a first authentication using these credentials.
+ */
+ } else {
+ /* Initially no password was provided => no authentication tried during first
+ * iteration of while loop in wsmc_handler. Check previously typed credentials
+ */
+ if (username_prev) {
+ /* This is a second call of this function, assuming only wsmc_handler is using it
+ * as a callback function. Therefore, there must have been a previous attempt to
+ * authenticate, but this previous combination of username and password did not
+ * lead to a successful authentication. Request new credentials, username_prev will
+ * be set each time after user has provided a username.
+ */
+ } else {
+ /* First time wsmc_handler calls back to this function. No password given on the
+ * command line or via the environment variable. Therefore wsmc_handler cannot
+ * have tried http authentication. A username was given on the command line or
+ * via an environment variable. And the user wants us to try this name at least
+ * at first. So, let's do him a favour and use it. When we are called back again,
+ * we will ask the user to provide a new name or the same, but a different password.
+ */
+ *username = u_strdup(username_given);
+ }
+ }
+ }
+
+ if (*username == NULL) {
+ 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;
+ }
+ }
+
+ /* after successfull receipt of a new username, store a copy at username_prev */
+ if (*username) {
+ if ( username_prev ) {
+ u_free(username_prev);
+ username_prev = NULL;
+ }
+ username_prev = u_strdup(*username);
}
+ /* but always ask for the password !? */
pw = (char *)getpass("Password: ");
*password = u_strdup_printf ("%s", pw);
-}
-
+ /* make backup, *password will become free'd when next try of http-auth fails */
+ if (*password) {
+ if (password_prev) {
+ u_free(password_prev);
+ password_prev = NULL;
+ }
+ password_prev = u_strdup(*password);
+ }
+}
static void
wsman_options_set_properties(client_opt_t *options)
@@ -647,6 +702,14 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ /* save copies of username or password when given on the command line or via environment variables */
+ if ( username != NULL ) {
+ username_given = u_strdup(username);
+ }
+ if ( password != NULL ) {
+ password_given = u_strdup(password);
+ }
+
filename = (char *) config_file;
if (filename) {

View file

@ -1,61 +0,0 @@
diff -up wsmancli-2.6.0/src/wsman.c.orig wsmancli-2.6.0/src/wsman.c
--- wsmancli-2.6.0/src/wsman.c.orig 2023-01-09 11:46:15.771553135 +0100
+++ wsmancli-2.6.0/src/wsman.c 2023-01-09 11:54:13.968830290 +0100
@@ -40,6 +40,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <termios.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -57,6 +58,8 @@
extern char *getpass (const char *__prompt);
#endif
+#define BASE_LEN 21
+
static long int server_port = 0;
static char *cainfo = NULL;
static char *cert = NULL;
@@ -498,6 +501,10 @@ request_usr_pwd( WsManClient *client, ws
char *pw;
char user[21];
char *p;
+ char c;
+ int len = BASE_LEN;
+ int pos = 0;
+ struct termios term;
/*
* fprintf(stdout,"Authentication failed, please retry\n");
@@ -560,8 +567,28 @@ request_usr_pwd( WsManClient *client, ws
}
/* but always ask for the password !? */
- pw = (char *)getpass("Password: ");
+ /* set no echo */
+ tcgetattr(1, &term);
+ term.c_lflag &= ~ECHO;
+ tcsetattr(1, TCSANOW, &term);
+ /* get pass */
+ pw = (char*) u_malloc(sizeof(char) * len);
+ pw[0] = '\0';
+ printf("Password: ");
+ fflush(stdout);
+ while ((c = fgetc(stdin)) != '\n') {
+ pw[pos++] = (char) c;
+ if (pos >= len) {
+ len += BASE_LEN;
+ pw = realloc(pw, len);
+ }
+ }
+ pw[pos] = '\0';
*password = u_strdup_printf ("%s", pw);
+ u_free(pw);
+ /* set echo back again */
+ term.c_lflag |= ECHO;
+ tcsetattr(1, TCSANOW, &term);
/* make backup, *password will become free'd when next try of http-auth fails */
if (*password) {

View file

@ -1 +1 @@
df418d6d78160fd4f88f890a8953907a wsmancli-2.6.0.tar.gz
SHA512 (wsmancli-2.8.0.tar.gz) = 61f1fa57ba8106c8e9b0d96296e99e1dc04eb3a2468630aa73c594e6403bfed3cc0946bc4fd633176fda50eeb24a1c3d2cec9697b11d9b5c6a4016eef050b86c

View file

@ -1,7 +1,7 @@
Name: wsmancli
Version: 2.6.0
Release: 20%{?dist}
License: BSD
Version: 2.8.0
Release: 4%{?dist}
License: BSD-3-Clause
Url: http://www.openwsman.org/
# You can get this tarball here:
# https://github.com/Openwsman/wsmancli/archive/v%%{version}.tar.gz
@ -14,8 +14,6 @@ BuildRequires: openwsman-devel >= 2.1.0 pkgconfig curl-devel
BuildRequires: autoconf automake libtool
Requires: openwsman curl
Patch0: missing-pthread-symbols.patch
Patch1: http-unauthorized-improve.patch
Patch2: replace-getpass.patch
Summary: WS-Management-Command line Interface
%description
@ -24,9 +22,7 @@ systems using Web Services Management protocol.
%prep
%setup -q
%patch0 -p1
%patch1 -p1 -b .http-unauthorized-improve
%patch2 -p1 -b .replace-getpass
%autopatch -p1
cp -fp %SOURCE1 %SOURCE2 %SOURCE3 .;
%build
@ -45,6 +41,36 @@ make DESTDIR=%{buildroot} install
%doc COPYING README AUTHORS
%changelog
* Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Tue Apr 08 2025 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.8.0-1
- Update to wsmancli-2.8.0
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri May 19 2023 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.6.2-1
- Update to wsmancli-2.6.2
* Tue Apr 25 2023 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.6.0-21
- SPDX migration
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.0-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild