- Timestamp:
- 04/24/06 20:57:25 (3 years ago)
- Location:
- releases/openct-0.6.7/src
- Files:
-
- 8 modified
-
ct/socket.c (modified) (2 diffs)
-
ifd/ifdhandler.c (modified) (5 diffs)
-
ifd/ifdproxy.c (modified) (4 diffs)
-
ifd/ria.c (modified) (3 diffs)
-
ifd/sys-linux.c (modified) (1 diff)
-
ifd/sys-solaris.c (modified) (2 diffs)
-
ifd/sys-sunray.c (modified) (1 diff)
-
include/openct/socket.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
releases/openct-0.6.7/src/ct/socket.c
r824 r850 23 23 #include <arpa/inet.h> 24 24 #include <netdb.h> 25 #include <limits.h> 25 26 26 27 #include <openct/logging.h> … … 240 241 * Listen on a socket 241 242 */ 242 int ct_socket_listen(ct_socket_t * sock, int reader, int mode) 243 { 244 char path[PATH_MAX]; 245 char file[PATH_MAX]; 246 247 snprintf(file, PATH_MAX, "%d", reader); 248 if (! ct_format_path(path, PATH_MAX, file)) { 249 return -1; 250 } 251 243 int ct_socket_listen(ct_socket_t * sock, const char *path, int mode) 244 { 252 245 ct_socket_close(sock); 253 246 if (ct_socket_make(sock, CT_MAKESOCK_BIND, path) < 0) -
releases/openct-0.6.7/src/ifd/ifdhandler.c
r820 r850 22 22 #include <limits.h> 23 23 24 #include <openct/path.h> 24 25 #include <openct/ifd.h> 25 26 #include <openct/conf.h> … … 35 36 static int opt_foreground = 0; 36 37 static int opt_info = 0; 37 static unsigned int opt_reader = -1;38 static const char *opt_reader = NULL; 38 39 39 40 static void usage(int exval); … … 72 73 break; 73 74 case 'r': 74 opt_reader = atoi(optarg);75 opt_reader = optarg; 75 76 break; 76 77 case 's': … … 111 112 * prevent race condition 112 113 */ 113 status = ct_status_alloc_slot(&opt_reader); 114 if (status == NULL) { 115 ct_error("too many readers, no reader slot available"); 116 return 1; 114 { 115 unsigned int r; 116 char path[PATH_MAX]; 117 118 status = ct_status_alloc_slot(&r); 119 if (status == NULL) { 120 ct_error("too many readers, no reader slot available"); 121 return 1; 122 } 123 snprintf(path,PATH_MAX,"%d",r); 124 opt_reader=strdup(path); 117 125 } 118 126 … … 177 185 int rc; 178 186 struct sigaction act; 187 char path[PATH_MAX]; 188 char file[PATH_MAX]; 189 190 if (! ct_format_path(path, PATH_MAX, file)) { 191 ct_error("ct_format_path failed!"); 192 exit(1); 193 } 179 194 180 195 /* Activate reader */ -
releases/openct-0.6.7/src/ifd/ifdproxy.c
r775 r850 25 25 #include <pwd.h> 26 26 #include <grp.h> 27 27 #include <limits.h> 28 29 #include <openct/path.h> 28 30 #include <openct/socket.h> 29 31 #include <openct/server.h> … … 32 34 #include "ria.h" 33 35 34 #define DEFAULT_SERVER_PATH OPENCT_SOCKET_PATH "/proxy"35 36 36 static int opt_foreground = 0; 37 37 static char *opt_config = NULL; 38 38 static const char *opt_device_port = ":6666"; 39 static const char *opt_server_port = OPENCT_SOCKET_PATH "/proxy";39 static const char *opt_server_port = "proxy"; 40 40 static const char *opt_chroot = NULL; 41 41 static const char *opt_user = NULL; … … 175 175 { 176 176 int rc; 177 char path[PATH_MAX]; 178 179 if (! ct_format_path(path, PATH_MAX, opt_server_port)) { 180 return -1; 181 } 182 177 183 178 184 if (argc != 0) … … 181 187 ct_socket_reuseaddr(1); 182 188 183 if ((rc = ria_svc_listen( opt_server_port, 1)) < 0) {189 if ((rc = ria_svc_listen(path, 1)) < 0) { 184 190 ct_error("Cannot bind to server port \"%s\": %s\n", 185 opt_server_port, ct_strerror(rc));191 path, ct_strerror(rc)); 186 192 return rc; 187 193 } -
releases/openct-0.6.7/src/ifd/ria.c
r846 r850 18 18 #include <fcntl.h> 19 19 #include <errno.h> 20 20 #include <limits.h> 21 22 #include <openct/path.h> 21 23 #include <openct/socket.h> 22 24 #include <openct/server.h> … … 35 37 { 36 38 ria_client_t *clnt; 37 int reader;39 char path[PATH_MAX]; 38 40 int rc; 39 41 40 if (scanf("5d",address,&reader) != 1) { 41 ct_error("can't parse address \"%s\"",address); 42 if (! address) { 43 return NULL; 44 } 45 46 if (! ct_format_path(path, PATH_MAX, address)) { 42 47 return NULL; 43 48 } … … 51 56 52 57 clnt->sock = ct_socket_new(1024); 53 if ((rc = ct_socket_connect(clnt->sock, reader)) < 0) {54 ct_error("Failed to connect to RIA server %d: %s",55 reader, ct_strerror(rc));58 if ((rc = ct_socket_connect(clnt->sock, path)) < 0) { 59 ct_error("Failed to connect to RIA server \"%s\": %s", 60 path, ct_strerror(rc)); 56 61 ria_free(clnt); 57 62 return NULL; -
releases/openct-0.6.7/src/ifd/sys-linux.c
r831 r850 25 25 #include <fcntl.h> 26 26 #include <errno.h> 27 #include <limits.h> 27 28 #ifdef HAVE_LIBUSB 28 29 #include <usb.h> -
releases/openct-0.6.7/src/ifd/sys-solaris.c
r831 r850 186 186 } 187 187 188 void 188 189 close_ep(int interface, int endpoint, int direction) 189 190 { … … 529 530 } 530 531 531 int ifd_sysdep_usb :open(const char *device)532 int ifd_sysdep_usb_open(const char *device) 532 533 { 533 534 return open(device, O_RDWR); -
releases/openct-0.6.7/src/ifd/sys-sunray.c
r831 r850 21 21 #include <unistd.h> 22 22 #include <errno.h> 23 #include <limits.h> 24 23 25 #include <openct/driver.h> 24 26 #define USB_READ_INTERRUPT_TIMEOUT_WORKAROUND 1 -
releases/openct-0.6.7/src/include/openct/socket.h
r820 r850 58 58 extern void ct_socket_reuseaddr(int); 59 59 extern int ct_socket_connect(ct_socket_t *, const char *); 60 extern int ct_socket_listen(ct_socket_t *, int, int);60 extern int ct_socket_listen(ct_socket_t *, const char *, int); 61 61 extern ct_socket_t * ct_socket_accept(ct_socket_t *); 62 62 extern void ct_socket_close(ct_socket_t *);
