diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/client.c b/src/client.c index c8fb470..ac5d08e 100644 --- a/src/client.c +++ b/src/client.c | |||
| @@ -42,11 +42,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
| 42 | #include "client.h" | 42 | #include "client.h" |
| 43 | #include "device.h" | 43 | #include "device.h" |
| 44 | 44 | ||
| 45 | #ifdef HAVE_PLIST | ||
| 46 | #define CMD_BUF_SIZE 1024 | 45 | #define CMD_BUF_SIZE 1024 |
| 47 | #else | ||
| 48 | #define CMD_BUF_SIZE 256 | ||
| 49 | #endif | ||
| 50 | #define REPLY_BUF_SIZE 1024 | 46 | #define REPLY_BUF_SIZE 1024 |
| 51 | 47 | ||
| 52 | enum client_state { | 48 | enum client_state { |
| @@ -387,6 +383,17 @@ static int client_command(struct mux_client *client, struct usbmuxd_header *hdr) | |||
| 387 | return -1; | 383 | return -1; |
| 388 | } | 384 | } |
| 389 | 385 | ||
| 386 | #ifdef HAVE_PLIST | ||
| 387 | if((hdr->version != 0) && (hdr->version != 1)) { | ||
| 388 | usbmuxd_log(LL_INFO, "Client %d version mismatch: expected 0 or 1, got %d", client->fd, hdr->version); | ||
| 389 | #else | ||
| 390 | if(hdr->version != USBMUXD_PROTOCOL_VERSION) { | ||
| 391 | usbmuxd_log(LL_INFO, "Client %d version mismatch: expected %d, got %d", client->fd, USBMUXD_PROTOCOL_VERSION, hdr->version); | ||
| 392 | #endif | ||
| 393 | send_result(client, hdr->tag, RESULT_BADVERSION); | ||
| 394 | return 0; | ||
| 395 | } | ||
| 396 | |||
| 390 | struct usbmuxd_connect_request *ch; | 397 | struct usbmuxd_connect_request *ch; |
| 391 | #ifdef HAVE_PLIST | 398 | #ifdef HAVE_PLIST |
| 392 | char *payload; | 399 | char *payload; |
| @@ -557,16 +564,6 @@ static void process_recv(struct mux_client *client) | |||
| 557 | did_read = 1; | 564 | did_read = 1; |
| 558 | } | 565 | } |
| 559 | struct usbmuxd_header *hdr = (void*)client->ib_buf; | 566 | struct usbmuxd_header *hdr = (void*)client->ib_buf; |
| 560 | #ifdef HAVE_PLIST | ||
| 561 | if((hdr->version != 0) && (hdr->version != 1)) { | ||
| 562 | usbmuxd_log(LL_INFO, "Client %d version mismatch: expected 0 or 1, got %d", client->fd, hdr->version); | ||
| 563 | #else | ||
| 564 | if(hdr->version != USBMUXD_PROTOCOL_VERSION) { | ||
| 565 | usbmuxd_log(LL_INFO, "Client %d version mismatch: expected %d, got %d", client->fd, USBMUXD_PROTOCOL_VERSION, hdr->version); | ||
| 566 | #endif | ||
| 567 | client_close(client); | ||
| 568 | return; | ||
| 569 | } | ||
| 570 | if(hdr->length > client->ib_capacity) { | 567 | if(hdr->length > client->ib_capacity) { |
| 571 | usbmuxd_log(LL_INFO, "Client %d message is too long (%d bytes)", client->fd, hdr->length); | 568 | usbmuxd_log(LL_INFO, "Client %d message is too long (%d bytes)", client->fd, hdr->length); |
| 572 | client_close(client); | 569 | client_close(client); |
