Show error if wrong username/password

SVN revision: 424
This commit is contained in:
Stefan Ritt 2003-03-01 16:07:02 +00:00
parent 8dfb6efad6
commit e5a0b5d12f

View File

@ -6,6 +6,9 @@
Contents: Electronic logbook utility Contents: Electronic logbook utility
$Log$ $Log$
Revision 1.2 2003/03/01 16:07:02 midas
Show error if wrong username/password
Revision 1.1 2003/01/30 14:45:07 midas Revision 1.1 2003/01/30 14:45:07 midas
Moved files to src/ subdirectory Moved files to src/ subdirectory
@ -363,31 +366,41 @@ char host_name[256], boundary[80], str[80], *p;
{ {
if (strstr(response, "Location:")) if (strstr(response, "Location:"))
{ {
strncpy(str, strstr(response, "Location:")+10, sizeof(str)); if (strstr(response, "wpwd"))
if (strchr(str, '?')) printf("Error: Invalid password\n");
*strchr(str, '?') = 0; else if (strstr(response, "wusr"))
if (strchr(str, '\n')) printf("Error: Invalid user name\n");
*strchr(str, '\n') = 0; else
if (strchr(str, '\r')) {
*strchr(str, '\r') = 0; strncpy(str, strstr(response, "Location:")+10, sizeof(str));
if (strchr(str, '?'))
*strchr(str, '?') = 0;
if (strchr(str, '\n'))
*strchr(str, '\n') = 0;
if (strchr(str, '\r'))
*strchr(str, '\r') = 0;
printf("Message successfully transmitted, ID=%s\n", str); if (strrchr(str, '/'))
printf("Message successfully transmitted, ID=%s\n", strrchr(str, '/')+1);
else
printf("Message successfully transmitted, ID=%s\n", str);
}
} }
else else
printf("Message successfully transmitted\n"); printf("Message successfully transmitted\n");
} }
else if (strstr(response, "Logbook Selection")) else if (strstr(response, "Logbook Selection"))
printf("No logbook specified\n"); printf("Error: No logbook specified\n");
else if (strstr(response, "enter password")) else if (strstr(response, "enter password"))
printf("Missing or invalid password\n"); printf("Error: Missing or invalid password\n");
else if (strstr(response, "login")) else if (strstr(response, "login"))
printf("Missing or invalid user name/password\n"); printf("Error: Missing or invalid user name/password\n");
else if (strstr(response, "Error: Attribute")) else if (strstr(response, "Error: Attribute"))
{ {
strncpy(str, strstr(response, "Error: Attribute")+20, sizeof(str)); strncpy(str, strstr(response, "Error: Attribute")+20, sizeof(str));
if (strchr(str, '<')) if (strchr(str, '<'))
*strchr(str, '<') = 0; *strchr(str, '<') = 0;
printf("Missing required attribute \"%s\"\n", str); printf("Error: Missing required attribute \"%s\"\n", str);
} }
else else
printf("Error transmitting message\n"); printf("Error transmitting message\n");