From: Adam Dickmeiss Date: Mon, 28 Jan 2002 09:25:38 +0000 (+0000) Subject: IdPass authentication. X-Git-Tag: YAZ.1.8.5~13 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=5754b092c42f45eeac52fb1223e51e2a11c92653 IdPass authentication. --- diff --git a/client/client.c b/client/client.c index e27a246..9980c11 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.136 2002-01-23 22:40:36 adam Exp $ + * $Id: client.c,v 1.137 2002-01-28 09:25:38 adam Exp $ */ #include @@ -340,7 +340,9 @@ int cmd_open(char *arg) int cmd_authentication(char *arg) { static Z_IdAuthentication au; - static char open[256]; + static char user[40], group[40], pass[40]; + static Z_IdPass idPass; + int r; if (!*arg) { @@ -348,10 +350,27 @@ int cmd_authentication(char *arg) auth = 0; return 1; } - auth = &au; - au.which = Z_IdAuthentication_open; - au.u.open = open; - strcpy(open, arg); + r = sscanf (arg, "%39s %39s %39s", user, group, pass); + if (r == 0) + { + printf("Auth field set to null\n"); + auth = 0; + } + if (r == 1) + { + auth = &au; + au.which = Z_IdAuthentication_open; + au.u.open = user; + } + if (r == 3) + { + auth = &au; + au.which = Z_IdAuthentication_idPass; + au.u.idPass = &idPass; + idPass.groupId = group; + idPass.userId = user; + idPass.password = pass; + } return 1; } @@ -2290,7 +2309,7 @@ int main(int argc, char **argv) case 0: if (!open_command) { - open_command = xmalloc (strlen(arg)+6); + open_command = (char *) xmalloc (strlen(arg)+6); strcpy (open_command, "open "); strcat (open_command, arg); } @@ -2321,7 +2340,7 @@ int main(int argc, char **argv) case 'u': if (!auth_command) { - auth_command = xmalloc (strlen(arg)+6); + auth_command = (char *) xmalloc (strlen(arg)+6); strcpy (auth_command, "auth "); strcat (auth_command, arg); } @@ -2332,7 +2351,7 @@ int main(int argc, char **argv) default: fprintf (stderr, "Usage: %s [-m ] [ -a ] " "[-c cclfields]\n [-p ] [-u ] " - "[]\n", + "[-k size] []\n", prog); exit (1); }