From c496029bc524f81c59c50ac928aa7ce603156359 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 11 Nov 2012 13:13:29 +0100 Subject: Use socat instead of socket-sucker.c from lightdm-remote-session-freerdp. --- socket-sucker.c | 80 --------------------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 socket-sucker.c (limited to 'socket-sucker.c') diff --git a/socket-sucker.c b/socket-sucker.c deleted file mode 100644 index 403819b..0000000 --- a/socket-sucker.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright © 2012 Mike Gabriel - * Copyright © 2012 Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - * - * Author: Mike Gabriel - * Author libpam-freerdp (where we forked from): Ted Gould - */ - -#include -#include -#include - -#include -#include -#include - -#define BUFFER_SIZE 256 - -int -main (int argc, char * argv[]) -{ - int socket_fd = 0; - int servlen = 0; - struct sockaddr_un serv_addr; - - bzero((char *)&serv_addr, sizeof(serv_addr)); - - const char * home = getenv("HOME"); - if (home == NULL) { - return -1; - } - - serv_addr.sun_family = AF_UNIX; - - int printsize = snprintf(serv_addr.sun_path, sizeof(serv_addr.sun_path) - 1, "%s/%s", home, ".x2go-socket"); - if (printsize > sizeof(serv_addr.sun_path) - 1 || printsize < 0) { - return -1; - } - - servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family); - - if ((socket_fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - return -1; - } - - if (connect(socket_fd, (struct sockaddr *)&serv_addr, servlen) < 0) { - return -1; - } - - char buffer[BUFFER_SIZE + 2]; - int in = 0; - int out = 0; - - in = read(socket_fd, buffer, BUFFER_SIZE); - - if (in > 0) { - out = write(1, buffer, in); - } - - close(socket_fd); - - if (in > 0 && out > 0 && in == out) { - return 0; - } else { - return -1; - } -} - -- cgit v1.2.3