don't send PASS cmd if password is empty
authorpk910 <philipp@zoelle1.de>
Sun, 2 Oct 2011 17:31:37 +0000 (19:31 +0200)
committerpk910 <philipp@zoelle1.de>
Sun, 2 Oct 2011 17:31:37 +0000 (19:31 +0200)
src/ClientSocket.c

index 98fefa7eedf5205024d62bc16123b6d0aa9420ce..30c2efb4ec7e2d9c7cf69280fc47719720a36884 100644 (file)
@@ -33,7 +33,7 @@ struct ClientSocket* create_socket(char *host, int port, char *pass, struct User
     }
     client->host = strdup(host);
     client->port = port;
-    printf("Connect: %s:%d", client->host, client->port);
+    printf("Connect: %s:%d\n", client->host, client->port);
     client->pass = (pass == NULL ? NULL : strdup(pass));
     client->user = user;
     client->flags = 0;
@@ -87,7 +87,7 @@ int connect_socket(struct ClientSocket *client) {
     char sendBuf[512];
     int len;
 
-    if(client->pass) {
+    if(client->pass && strcmp(client->pass, "")) {
         len = sprintf(sendBuf, "PASS :%s\n", client->pass);
         write_socket(client, sendBuf, len);
     }