Permalink
Browse files

Fix auth_callback logic - Thanks Ben Menchaca

--HG--
extra : convert_revision : svn%3Abef2e6be-9598-11dd-8950-3d966a63a0de/trunk%4079
  • Loading branch information...
1 parent ae593bc commit c742e9a336f999143cabb1cb727fb6c51ff84736 fred_nerk committed Feb 19, 2007
Showing with 14 additions and 8 deletions.
  1. +2 −2 libcli/Makefile
  2. +5 −1 libcli/clitest.c
  3. +3 −4 libcli/libcli.c
  4. +4 −1 libcli/libcli.spec
View
@@ -3,13 +3,13 @@ PREFIX = /usr/local
MAJOR = 1
MINOR = 8
-REVISION = 7
+REVISION = 8
LIB = libcli.so
CC = gcc
DEBUG = -g
OPTIM = -O3
-CFLAGS += $(DEBUG) $(OPTIM) -Wall -Wextra -Wformat-security -Wno-format-zero-length
+CFLAGS += $(DEBUG) $(OPTIM) -Wall -Wformat-security -Wno-format-zero-length
LDFLAGS += -shared -Wl,-soname,$(LIB).$(MAJOR).$(MINOR)
LIBPATH += -L.
LIBS = -lcrypt
View
@@ -68,7 +68,11 @@ int cmd_config_int_exit(struct cli_def *cli, UNUSED(char *command),
int check_auth(char *username, char *password)
{
- return !(strcasecmp(username, "fred") || strcasecmp(password, "nerk"));
+ if (strcasecmp(username, "fred") != 0)
+ return CLI_ERROR;
+ if (strcasecmp(password, "nerk") != 0)
+ return CLI_ERROR;
+ return CLI_OK;
}
int check_enable(char *password)
View
@@ -1196,7 +1196,7 @@ int cli_loop(struct cli_def *cli, int sockfd)
/* no auth required? */
if (!cli->users && !cli->auth_callback)
- cli->state = STATE_NORMAL;
+ cli->state = STATE_NORMAL;
while (1)
{
@@ -1789,9 +1789,8 @@ int cli_loop(struct cli_def *cli, int sockfd)
free(password);
password = strdup(cmd);
- if (cli->auth_callback &&
- cli->auth_callback(username, password))
- allowed++;
+ if (cli->auth_callback && cli->auth_callback(username, password) == CLI_OK)
+ allowed++;
if (!allowed)
{
View
@@ -1,4 +1,4 @@
-Version: 1.8.6
+Version: 1.8.8
Summary: Cisco-like telnet command-line library
Name: libcli
Release: 1
@@ -38,6 +38,9 @@ rm -rf $RPM_BUILD_ROOT
%doc README Doc/usersguide.html Doc/developers.html
%changelog
+* Mon Jan 19 2007 David Parrish <david@dparrish.com> 1.8.8-1
+- Fix broken auth_callback logic - Thanks Ben Menchaca
+
* Sat Jun 17 2006 Brendan O'Dea <bod@optus.net> 1.8.7-1
- Code cleanups.
- Declare internal functions static.

0 comments on commit c742e9a

Please sign in to comment.