bool AcceptClient(UnixSocket csock, out ServerConnection conn) { //TODO: use the right abstraction here, probably using the Server class UnixNativeTransport transport = new UnixNativeTransport(); //client.Client.Blocking = true; transport.socket = csock; transport.SocketHandle = (long)csock.Handle; transport.Stream = new UnixStream(csock); //Connection conn = new Connection (transport); //Connection conn = new ServerConnection (transport); //ServerConnection conn = new ServerConnection (transport); conn = new ServerConnection(transport); conn.Server = this; conn.Id = Id; if (conn.Transport.Stream.ReadByte() != 0) return false; conn.isConnected = true; SaslPeer remote = new SaslPeer(); remote.stream = transport.Stream; SaslServer local = new SaslServer(); local.stream = transport.Stream; local.Guid = Id; local.Peer = remote; remote.Peer = local; bool success = local.Authenticate(); Console.WriteLine("Success? " + success); if (!success) return false; conn.UserId = ((SaslServer)local).uid; conn.isAuthenticated = true; return true; }
bool AcceptClient(UnixSocket csock, out ServerConnection conn) { //TODO: use the right abstraction here, probably using the Server class UnixNativeTransport transport = new UnixNativeTransport(); //client.Client.Blocking = true; transport.socket = csock; transport.SocketHandle = (long)csock.Handle; transport.Stream = new UnixStream(csock); //Connection conn = new Connection (transport); //Connection conn = new ServerConnection (transport); //ServerConnection conn = new ServerConnection (transport); conn = new ServerConnection(transport); conn.Server = this; //conn.Id = Id; if (conn.Transport.Stream.ReadByte() != 0) { return(false); } //conn.isConnected = true; SaslPeer remote = new SaslPeer(); remote.stream = transport.Stream; SaslServer local = new SaslServer(); local.stream = transport.Stream; local.Guid = Id; local.Peer = remote; remote.Peer = local; bool success = local.Authenticate(); Console.WriteLine("Success? " + success); if (!success) { return(false); } conn.UserId = ((SaslServer)local).uid; //conn.isAuthenticated = true; return(true); }
bool AcceptClient(PipeStream client, out ServerConnection conn) { PipeTransport transport = new PipeTransport(); //client.Client.Blocking = true; //transport.SocketHandle = (long)client.Client.Handle; transport.Stream = client; conn = new ServerConnection(transport); conn.Server = this; conn.Id = Id; if (conn.Transport.Stream.ReadByte() != 0) { return(false); } conn.isConnected = true; SaslPeer remote = new SaslPeer(); remote.stream = transport.Stream; SaslServer local = new SaslServer(); local.stream = transport.Stream; local.Guid = Id; local.Peer = remote; remote.Peer = local; bool success = local.Authenticate(); //bool success = true; Console.WriteLine("Success? " + success); if (!success) { return(false); } conn.UserId = ((SaslServer)local).uid; conn.isAuthenticated = true; return(true); }
bool AcceptClient(PipeStream client, out ServerConnection conn) { PipeTransport transport = new PipeTransport (); //client.Client.Blocking = true; //transport.SocketHandle = (long)client.Client.Handle; transport.Stream = client; conn = new ServerConnection (transport); conn.Server = this; conn.Id = Id; if (conn.Transport.Stream.ReadByte () != 0) return false; conn.isConnected = true; SaslPeer remote = new SaslPeer (); remote.stream = transport.Stream; SaslServer local = new SaslServer (); local.stream = transport.Stream; local.Guid = Id; local.Peer = remote; remote.Peer = local; bool success = local.Authenticate (); //bool success = true; Console.WriteLine ("Success? " + success); if (!success) return false; conn.UserId = ((SaslServer)local).uid; conn.isAuthenticated = true; return true; }