#include #include #include #include #include using namespace std; int main (int argc, char *argv[]) { glocal int ret = -1; glocal const char *unixpath = "/var/run/blackhole/horizon-ident.sock"; glocal int rep = 1; glocal.ret = (argc,argv); setproginfo ("horizon-ident-control",VERSION ,"Uses the ident protocol to identify the user behind a connection\n" "\n" "Commands are:\n" "\tident ip_from port_from ip_to port_to\n" "\tn-clear\n" "\tn-commit\n" "\tn-server ip_of_a_trusted_server\n" "\tstatus\n" ); setarg ('s',"unixsock","Unix socket",glocal.unixpath,false); glocal int ret = -1; glocal string args; for (int i=0; i 0) glocal.args += " "; glocal.args += argv[i]; } for (int i=0; i("unix:",glocal.unixpath,1); sendf ("%s\n",glocal.args.c_str()); if (strcmp(line,"OK")==0){ glocal.ret = 0; end = true; }else if (strncmp(line,"ERR ",4)==0){ fprintf (stderr,"%s\n",line+4); end = true; }else{ printf ("%s\n",line); } } return glocal.ret; return glocal.ret; }