| 41 | import edu.mit.jgss.swig.*; |
| 42 | |
| 43 | public class Util implements gsswrapperConstants{ |
| 44 | |
| 45 | private static boolean DEBUG = false; |
| 46 | |
| 47 | /* |
| 48 | * Display error and exit program. |
| 49 | */ |
| 50 | public static void errorExit(String msg, long[] min_stat, long maj_stat) |
| 51 | { |
| 52 | System.out.println("Error: " + msg); |
| 53 | System.out.println("maj_stat = " + maj_stat + ", min_stat = " |
| 54 | + (int)min_stat[0]); |
| 55 | display_status(min_stat, maj_stat); |
| 56 | System.exit(1); |
| 57 | } |
| 58 | |
| 59 | /* |
| 60 | * Display error and continue. |
| 61 | */ |
| 62 | public static void displayError(String msg, long[] min_stat, long maj_stat) |
| 63 | { |
| 64 | System.out.println("Error: " + msg); |
| 65 | System.out.println("maj_stat = " + maj_stat + ", min_stat = " |
| 66 | + (int)min_stat[0]); |
| 67 | display_status(min_stat, maj_stat); |
| 68 | } |
| 69 | |
| 70 | /* |
| 71 | * Display status using minor and major status codes |
| 72 | */ |
| 73 | public static void display_status(long[] min_stat, long maj_stat) |
| 74 | { |
| 75 | long[] msg_ctx = {0}; |
| 76 | long ret = 0; |
| 77 | gss_buffer_desc storage_buffer = new gss_buffer_desc(); |
| 78 | |
| 79 | // Print GSS major status code error |
| 80 | ret = gsswrapper.gss_display_status_wrap(min_stat[0], maj_stat, |
| 81 | GSS_C_GSS_CODE, |
| 82 | GSS_C_NO_OID, |
| 83 | msg_ctx, storage_buffer); |
| 84 | if (ret != GSS_S_COMPLETE) { |
| 85 | System.out.println("gss_display_status failed"); |
| 86 | System.exit(1); |
| 87 | } |
| 88 | System.out.println("Error message (major): " |
| 89 | + storage_buffer.getValue()); |
| 90 | |
| 91 | // Print mechanism minor status code error |
| 92 | ret = gsswrapper.gss_display_status_wrap(maj_stat, min_stat[0], |
| 93 | GSS_C_MECH_CODE, |
| 94 | GSS_C_NO_OID, msg_ctx, storage_buffer); |
| 95 | if (ret != GSS_S_COMPLETE) { |
| 96 | System.out.println("gss_display_status failed"); |
| 97 | System.exit(1); |
| 98 | } |
| 99 | System.out.println("Error message (minor): " |
| 100 | + storage_buffer.getValue()); |
nothing calls this directly
no outgoing calls
no test coverage detected