Commit 5a59f6663d8a24a2db5f6a99b6901f0f76bd7afa
1 parent
bedd772c
Exists in
master
and in
5 other branches
Incluindo métod para scripts determinarem se a conexão é segura.
Showing
15 changed files
with
117 additions
and
50 deletions
Show diff stats
configure.ac
pw3270.cbp
... | ... | @@ -69,8 +69,6 @@ |
69 | 69 | <Unit filename="makedeb.sh" /> |
70 | 70 | <Unit filename="makegtkruntime.sh.in" /> |
71 | 71 | <Unit filename="man/man1/pw3270.1" /> |
72 | - <Unit filename="pw3270-i686.nsi.in" /> | |
73 | - <Unit filename="pw3270-x86_64.nsi.in" /> | |
74 | 72 | <Unit filename="pw3270.spec.in" /> |
75 | 73 | <Unit filename="src/classlib/Makefile.in" /> |
76 | 74 | <Unit filename="src/classlib/class.mak.in" /> | ... | ... |
src/classlib/local.cc
... | ... | @@ -121,49 +121,51 @@ |
121 | 121 | H3270 * hSession; |
122 | 122 | |
123 | 123 | // Lib3270 entry points |
124 | - const char * (*_get_version)(void); | |
125 | - LIB3270_CSTATE (*_get_connection_state)(H3270 *h); | |
126 | - LIB3270_MESSAGE (*_get_program_message)(H3270 *h); | |
127 | - | |
128 | - int (*_disconnect)(H3270 *h); | |
129 | - int (*_connect)(H3270 *h,int wait); | |
130 | - const char (*_set_url)(H3270 *h, const char *n); | |
131 | - int (*_is_connected)(H3270 *h); | |
132 | - void (*_main_iterate)(H3270 *h, int wait); | |
133 | - int (*_wait)(H3270 *hSession, int seconds); | |
134 | - int (*_enter)(H3270 *hSession); | |
135 | - int (*_pfkey)(H3270 *hSession, int key); | |
136 | - int (*_pakey)(H3270 *hSession, int key); | |
137 | - int (*_wait_for_ready)(H3270 *hSession, int seconds); | |
138 | - char * (*_get_text)(H3270 *h, int offset, int len); | |
139 | - char * (*_get_text_at)(H3270 *h, int row, int col, int len); | |
140 | - int (*_cmp_text_at)(H3270 *h, int row, int col, const char *text); | |
141 | - int (*_set_text_at)(H3270 *h, int row, int col, const unsigned char *str); | |
142 | - int (*_is_ready)(H3270 *h); | |
143 | - int (*_set_cursor_position)(H3270 *h, int row, int col); | |
144 | - int (*_set_toggle)(H3270 *h, LIB3270_TOGGLE ix, int value); | |
145 | - int (*_get_field_start)(H3270 *h, int baddr); | |
146 | - int (*_get_field_len)(H3270 *h, int baddr); | |
147 | - int (*_set_cursor_addr)(H3270 *h, int addr); | |
148 | - int (*_get_cursor_addr)(H3270 *h); | |
149 | - int (*_emulate_input)(H3270 *session, const char *s, int len, int pasting); | |
150 | - int (*_get_next_unprotected)(H3270 *hSession, int baddr0); | |
151 | - int (*_get_is_protected)(H3270 *hSession, int baddr); | |
152 | - int (*_get_is_protected_at)(H3270 *hSession, int row, int col); | |
153 | - void (*_popup_va)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); | |
154 | - void * (*_free)(void *); | |
155 | - const char * (*_get_display_charset)(H3270 *hSession); | |
156 | - int (*_set_host_charset)(H3270 *hSession, const char *name); | |
157 | - const char * (*_get_host_charset)(H3270 *hSession); | |
158 | - int (*_print)(H3270 *hSession); | |
159 | - int (*_erase)(H3270 *hSession); | |
160 | - int (*_erase_eof)(H3270 *hSession); | |
161 | - int (*_erase_eol)(H3270 *hSession); | |
162 | - int (*_erase_input)(H3270 *hSession); | |
163 | - int (*_action)(H3270 *hSession, const char *name); | |
164 | - | |
165 | - const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); | |
166 | - const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); | |
124 | + const char * (*_get_version)(void); | |
125 | + LIB3270_CSTATE (*_get_connection_state)(H3270 *h); | |
126 | + LIB3270_MESSAGE (*_get_program_message)(H3270 *h); | |
127 | + LIB3270_SSL_STATE (*_get_secure)(H3270 *h); | |
128 | + | |
129 | + | |
130 | + int (*_disconnect)(H3270 *h); | |
131 | + int (*_connect)(H3270 *h,int wait); | |
132 | + const char (*_set_url)(H3270 *h, const char *n); | |
133 | + int (*_is_connected)(H3270 *h); | |
134 | + void (*_main_iterate)(H3270 *h, int wait); | |
135 | + int (*_wait)(H3270 *hSession, int seconds); | |
136 | + int (*_enter)(H3270 *hSession); | |
137 | + int (*_pfkey)(H3270 *hSession, int key); | |
138 | + int (*_pakey)(H3270 *hSession, int key); | |
139 | + int (*_wait_for_ready)(H3270 *hSession, int seconds); | |
140 | + char * (*_get_text)(H3270 *h, int offset, int len); | |
141 | + char * (*_get_text_at)(H3270 *h, int row, int col, int len); | |
142 | + int (*_cmp_text_at)(H3270 *h, int row, int col, const char *text); | |
143 | + int (*_set_text_at)(H3270 *h, int row, int col, const unsigned char *str); | |
144 | + int (*_is_ready)(H3270 *h); | |
145 | + int (*_set_cursor_position)(H3270 *h, int row, int col); | |
146 | + int (*_set_toggle)(H3270 *h, LIB3270_TOGGLE ix, int value); | |
147 | + int (*_get_field_start)(H3270 *h, int baddr); | |
148 | + int (*_get_field_len)(H3270 *h, int baddr); | |
149 | + int (*_set_cursor_addr)(H3270 *h, int addr); | |
150 | + int (*_get_cursor_addr)(H3270 *h); | |
151 | + int (*_emulate_input)(H3270 *session, const char *s, int len, int pasting); | |
152 | + int (*_get_next_unprotected)(H3270 *hSession, int baddr0); | |
153 | + int (*_get_is_protected)(H3270 *hSession, int baddr); | |
154 | + int (*_get_is_protected_at)(H3270 *hSession, int row, int col); | |
155 | + void (*_popup_va)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); | |
156 | + void * (*_free)(void *); | |
157 | + const char * (*_get_display_charset)(H3270 *hSession); | |
158 | + int (*_set_host_charset)(H3270 *hSession, const char *name); | |
159 | + const char * (*_get_host_charset)(H3270 *hSession); | |
160 | + int (*_print)(H3270 *hSession); | |
161 | + int (*_erase)(H3270 *hSession); | |
162 | + int (*_erase_eof)(H3270 *hSession); | |
163 | + int (*_erase_eol)(H3270 *hSession); | |
164 | + int (*_erase_input)(H3270 *hSession); | |
165 | + int (*_action)(H3270 *hSession, const char *name); | |
166 | + | |
167 | + const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); | |
168 | + const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); | |
167 | 169 | |
168 | 170 | public: |
169 | 171 | |
... | ... | @@ -186,6 +188,7 @@ |
186 | 188 | { (void **) & _is_connected, "lib3270_is_connected" }, |
187 | 189 | { (void **) & _get_connection_state, "lib3270_get_connection_state" }, |
188 | 190 | { (void **) & _get_program_message, "lib3270_get_program_message" }, |
191 | + { (void **) & _get_secure, "lib3270_get_secure" }, | |
189 | 192 | |
190 | 193 | { (void **) & _get_version, "lib3270_get_version" }, |
191 | 194 | { (void **) & _disconnect, "lib3270_disconnect" }, |
... | ... | @@ -273,6 +276,10 @@ |
273 | 276 | return _get_program_message(hSession); |
274 | 277 | } |
275 | 278 | |
279 | + LIB3270_SSL_STATE get_secure(void) { | |
280 | + return _get_secure(hSession); | |
281 | + }; | |
282 | + | |
276 | 283 | int connect(void) |
277 | 284 | { |
278 | 285 | return _connect(hSession,0); | ... | ... |
src/classlib/remote.cc
... | ... | @@ -52,6 +52,7 @@ |
52 | 52 | #define HLLAPI_PACKET_IS_CONNECTED "isConnected" |
53 | 53 | #define HLLAPI_PACKET_GET_CSTATE "getConnectionState" |
54 | 54 | #define HLLAPI_PACKET_GET_PROGRAM_MESSAGE "getProgramMessage" |
55 | + #define HLLAPI_PACKET_GET_SSL_STATE "getSecureState" | |
55 | 56 | #define HLLAPI_PACKET_IS_READY "isReady" |
56 | 57 | #define HLLAPI_PACKET_DISCONNECT "disconnect" |
57 | 58 | #define HLLAPI_PACKET_GET_CURSOR "getCursorAddress" |
... | ... | @@ -730,6 +731,11 @@ |
730 | 731 | return (LIB3270_MESSAGE) query_intval(HLLAPI_PACKET_GET_PROGRAM_MESSAGE); |
731 | 732 | } |
732 | 733 | |
734 | + LIB3270_SSL_STATE get_secure(void) { | |
735 | + return (LIB3270_SSL_STATE) query_intval(HLLAPI_PACKET_GET_SSL_STATE); | |
736 | + } | |
737 | + | |
738 | + | |
733 | 739 | int connect(void) |
734 | 740 | { |
735 | 741 | int rc; | ... | ... |
src/include/pw3270/class.h
src/include/pw3270/ipcpackets.h
src/java/Makefile.in
... | ... | @@ -142,16 +142,18 @@ $(BINRLS)/$(PACKAGE_NAME).jar: $(BINDIR)/java/$(PACKAGE_NAME)/terminal.class |
142 | 142 | |
143 | 143 | #---[ Release targets ]-------------------------------------------------------- |
144 | 144 | |
145 | -all: $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ | |
145 | +all: \ | |
146 | + $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ | |
146 | 147 | |
147 | 148 | Release: \ |
148 | 149 | $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \ |
149 | 150 | $(BINDIR)/java/testprogram.class \ |
150 | 151 | $(BINRLS)/plugins/j3270@DLLEXT@ |
151 | 152 | |
152 | -zip: jni3270-@host_cpu@.zip | |
153 | +zip: \ | |
154 | + jni3270-@jvm_arch@.zip | |
153 | 155 | |
154 | -jni3270-@host_cpu@.zip: \ | |
156 | +jni3270-@jvm_arch@.zip: \ | |
155 | 157 | $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \ |
156 | 158 | $(BINRLS)/$(PACKAGE_NAME).jar \ |
157 | 159 | testprogram.java \ |
... | ... | @@ -229,7 +231,10 @@ $(BINDBG)/plugins/j3270@DLLEXT@: \ |
229 | 231 | -L../../.bin/Debug@DLLDIR@ -l3270 -lpw3270 \ |
230 | 232 | -L$(BINDBG)@DLLDIR@ -ljni3270 |
231 | 233 | |
232 | -run: $(BINDBG)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ $(BINDIR)/java/testprogram.class | |
234 | +run: \ | |
235 | + $(BINDBG)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \ | |
236 | + $(BINDIR)/java/testprogram.class | |
237 | + | |
233 | 238 | @LD_LIBRARY_PATH=../../.bin/Debug@DLLDIR@/ java -Djava.library.path=$(BINDBG)@DLLDIR@ -cp .bin/java/ testprogram |
234 | 239 | |
235 | 240 | #---[ Misc targets ]----------------------------------------------------------- | ... | ... |
src/java/info.cc
... | ... | @@ -55,3 +55,21 @@ JNIEXPORT jstring JNICALL Java_pw3270_terminal_get_1encoding(JNIEnv *env, jobjec |
55 | 55 | return env->NewStringUTF(s->get_encoding()); |
56 | 56 | |
57 | 57 | } |
58 | + | |
59 | +JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1secure(JNIEnv *env, jobject obj) { | |
60 | + | |
61 | + jint rc = -1; | |
62 | + | |
63 | + try { | |
64 | + | |
65 | + rc = java::getHandle(env,obj)->get_secure(); | |
66 | + | |
67 | + } catch(std::exception &e) { | |
68 | + | |
69 | + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); | |
70 | + | |
71 | + } | |
72 | + | |
73 | + return rc; | |
74 | + | |
75 | +} | ... | ... |
src/java/plugin.cc
src/java/terminal.java
... | ... | @@ -397,10 +397,18 @@ public class terminal |
397 | 397 | public native void log(String msg); |
398 | 398 | |
399 | 399 | /** |
400 | + * Get connection SSL state | |
401 | + * | |
402 | + * @return State of SSL connection (0 = Inseguro, 1 = CA válido, 2 = CA inválido ou auto-assinado, 3 = Negociando, 4 = Indefinido) | |
403 | + * | |
404 | + */ | |
405 | + public native int get_secure(); | |
406 | + | |
407 | + /** | |
400 | 408 | * Creates a tn3270 terminal associated with a |
401 | 409 | * pw3270 window. |
402 | 410 | * |
403 | - * @param id String identifying the target window. | |
411 | + * @param id String identifying the target window ("pw3270:a") or "" to run without window. | |
404 | 412 | * |
405 | 413 | */ |
406 | 414 | public terminal(String id) { | ... | ... |
src/plugins/dbus3270/gobject.c
... | ... | @@ -133,6 +133,11 @@ void pw3270_dbus_get_connection_state(PW3270Dbus *object, DBusGMethodInvocation |
133 | 133 | dbus_g_method_return(context,lib3270_get_connection_state(pw3270_dbus_get_session_handle(object))); |
134 | 134 | } |
135 | 135 | |
136 | +void pw3270_dbus_get_secure_state(PW3270Dbus *object, DBusGMethodInvocation *context) | |
137 | +{ | |
138 | + trace("%s object=%p context=%p",__FUNCTION__,object,context); | |
139 | + dbus_g_method_return(context,lib3270_get_secure(pw3270_dbus_get_session_handle(object))); | |
140 | +} | |
136 | 141 | |
137 | 142 | GError * pw3270_dbus_get_error_from_errno(int code) |
138 | 143 | { | ... | ... |
src/plugins/dbus3270/pw3270dbus.xml
... | ... | @@ -31,6 +31,10 @@ |
31 | 31 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> |
32 | 32 | <arg type="i" name="status" direction="out" /> |
33 | 33 | </method> |
34 | + <method name="getSecureState"> | |
35 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | |
36 | + <arg type="i" name="status" direction="out" /> | |
37 | + </method> | |
34 | 38 | <method name="getScreenContents"> |
35 | 39 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> |
36 | 40 | <arg type="s" name="contents" direction="out" /> | ... | ... |
src/plugins/dbus3270/service.h
... | ... | @@ -68,8 +68,11 @@ |
68 | 68 | void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context); |
69 | 69 | void pw3270_dbus_set_host(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context); |
70 | 70 | void pw3270_dbus_disconnect(PW3270Dbus *object, DBusGMethodInvocation *context); |
71 | + | |
71 | 72 | void pw3270_dbus_get_message_id(PW3270Dbus *object, DBusGMethodInvocation *context); |
72 | 73 | void pw3270_dbus_get_connection_state(PW3270Dbus *object, DBusGMethodInvocation *context); |
74 | + void pw3270_dbus_get_secure_state(PW3270Dbus *object, DBusGMethodInvocation *context); | |
75 | + | |
73 | 76 | void pw3270_dbus_get_screen_contents(PW3270Dbus *object, DBusGMethodInvocation *context); |
74 | 77 | H3270 * pw3270_dbus_get_session_handle(PW3270Dbus *object); |
75 | 78 | GError * pw3270_dbus_get_error_from_errno(int code); | ... | ... |
src/plugins/hllapi/pluginmain.c
... | ... | @@ -324,6 +324,10 @@ |
324 | 324 | send_result(source,lib3270_get_program_message(lib3270_get_default_session_handle())); |
325 | 325 | break; |
326 | 326 | |
327 | + case HLLAPI_PACKET_GET_SSL_STATE: | |
328 | + send_result(source,lib3270_get_secure(lib3270_get_default_session_handle())); | |
329 | + break; | |
330 | + | |
327 | 331 | case HLLAPI_PACKET_SET_TOGGLE: |
328 | 332 | send_result(source,lib3270_set_toggle(lib3270_get_default_session_handle(), |
329 | 333 | (LIB3270_TOGGLE) ((struct hllapi_packet_set *) source->buffer)->id, | ... | ... |
src/plugins/rx3270/pluginmain.cc