(String argv[])
| 52 | public static gss_ctx_id_t_desc context = new gss_ctx_id_t_desc(); |
| 53 | |
| 54 | public static void main(String argv[]) throws Exception |
| 55 | { |
| 56 | int server_port = 11115; |
| 57 | String serviceName = "service@host"; |
| 58 | int ret = 0; |
| 59 | int authorizationError = 0; |
| 60 | long maj_status = 0; |
| 61 | long[] min_status = {0}; |
| 62 | String clientMsg; |
| 63 | gss_ctx_id_t_desc gssContext = GSS_C_NO_CONTEXT; |
| 64 | gss_cred_id_t_desc serverCreds = new gss_cred_id_t_desc(); |
| 65 | |
| 66 | /* create input and output streams */ |
| 67 | ServerSocket serverSocket = null; |
| 68 | Socket clientSocket = null; |
| 69 | OutputStream clientOut = null; |
| 70 | InputStream clientIn = null; |
| 71 | |
| 72 | /* create server socket */ |
| 73 | try { |
| 74 | serverSocket = new ServerSocket(server_port); |
| 75 | } catch (IOException e) { |
| 76 | System.out.println("Error on port: " + server_port + ", " + e); |
| 77 | System.exit(1); |
| 78 | } |
| 79 | |
| 80 | System.out.println("Started Java GSS-API server example, " + |
| 81 | "waiting for client connection..."); |
| 82 | |
| 83 | while(true) |
| 84 | { |
| 85 | try { |
| 86 | |
| 87 | clientSocket = serverSocket.accept(); |
| 88 | |
| 89 | /* get input and output streams */ |
| 90 | clientOut = clientSocket.getOutputStream(); |
| 91 | clientIn = clientSocket.getInputStream(); |
| 92 | System.out.println("Client connection received"); |
| 93 | |
| 94 | } catch (IOException e) { |
| 95 | System.out.println("Server did not accept connection: " + e); |
| 96 | } |
| 97 | |
| 98 | /* Import service name and acquire creds for it, |
| 99 | * returns NULL on failure */ |
| 100 | serverCreds = AcquireServerCreds(serviceName); |
| 101 | |
| 102 | if (serverCreds != null) { |
| 103 | System.out.println("Finished acquiring server creds"); |
| 104 | /* Stores created context in global static "context" */ |
| 105 | ret = Authenticate(clientSocket, clientIn, clientOut); |
| 106 | |
| 107 | if (ret == 0) { |
| 108 | System.out.println("Finished Authentication"); |
| 109 | /* Using gss_unwrap / gss_get_mic */ |
| 110 | ret = Communicate(clientSocket, clientIn, clientOut); |
| 111 |
nothing calls this directly
no test coverage detected