x11-ssh-askpass-1.2.4.1/0040755000135600013560000000000007351324572014730 5ustar jmknoblejmknoblex11-ssh-askpass-1.2.4.1/ChangeLog0100644000135600013560000003155007351324572016503 0ustar jmknoblejmknoble2001-09-17 03:42 jmknoble * Imakefile.in: Bumped version to 1.2.4.1 to correct problem with autogenerated Imakefile in distribution tarball for v1.2.4. 2001-09-16 18:10 jmknoble * Imakefile.in: Bumped version to 1.2.4. 2001-09-16 18:09 jmknoble * Imakefile.in, README, SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad, configure, drawing.c, drawing.h, dynlist.c, dynlist.h, resources.c, resources.h, x11-ssh-askpass.c, x11-ssh-askpass.h, x11-ssh-askpass.man.in: Changed email address from back to . 2001-09-16 17:51 jmknoble * Imakefile.in: Changed 'distclean:' target to 'squeakyclean:', since XFree86-4.1.0 and later have a conflicting 'distclean::' target in their imake configuration. Bumped to version 1.2.3. 2001-04-02 19:17 jmknoble * Imakefile.in: New version 1.2.2. 2001-04-02 19:15 jmknoble * Imakefile.in, configure: Added setting of $(CC) if CC is set in the environment. Display compiler, cflags, and ldflags settings at end of configuration. Added '--default' option to ./configure to allow maintainer (me:) to generate an Imakefile containing default settings for putting in the distribution tarball. 2001-04-01 20:16 jmknoble * Imakefile.in: New version 1.2.1. 2001-04-01 20:16 jmknoble * .cvsignore: Added autogenerated Imakefile to .cvsignore. 2001-04-01 20:13 jmknoble * README: Revised installation instructions for new configure method. 2001-04-01 20:12 jmknoble * configure: Slightly improved instructions at end. 2001-04-01 19:56 jmknoble * configure: Oops ... wrong copyright date. 2001-04-01 19:56 jmknoble * Imakefile, Imakefile.in, configure: Added capability to detect autoconf's default location for libexecdir if we're building x11-ssh-askpass inside a portable-OpenSSH source tree. Requires the user to run the new 'configure' script. Moved Imakefile to Imakefile.in; Imakefile is now generated by configure. configure accepts the expected options for specifying prefix, libexecdir, mandir, etc. Also available are '--with-XXX' and '--disable-XXX' options to select the app-defaults file to garner fallback resources from, and to say whether and where to install the selected app-defaults file. 2001-04-01 19:21 jmknoble * dynlist.c: Updated copyright date. 2001-04-01 17:43 jmknoble * TODO, dynlist.c: (Sigh). I give in. Modified dynlist.c to work on stupid/broken systems where realloc(NULL, n) != malloc(n). Thanks to Charles Levert and Steve VanDevender . 2001-02-14 04:10 jmknoble * Imakefile: New version 1.2.0. 2001-02-14 04:07 jmknoble * README, x11-ssh-askpass.c, x11-ssh-askpass.h, x11-ssh-askpass.man.in: Updated copyright notices to include 2001. 2001-02-14 04:06 jmknoble * Imakefile, README: Moved default BINDIR to /usr/local/libexec/openssh to conform with recent releases of portable OpenSSH. 2001-02-14 03:59 jmknoble * x11-ssh-askpass.c, x11-ssh-askpass.h, x11-ssh-askpass.man.in: Now x11-ssh-askpass understands newline characters ('\n') in text labels (both the prompt string and the button labels). Each line of text in the label is displayed on a separate line in the dialog. Requested by Markus Friedl to support challenge/response authentication in OpenSSH. 2001-02-14 03:49 jmknoble * x11-ssh-askpass.c: Bugfix: "*grabServer" resource was setting flag to grab pointer. Fixed. (Not surprising that no one noticed; i suspect it's not very widely used). 2001-02-14 03:46 jmknoble * x11-ssh-askpass.man.in: Merged changes from matthieu@openbsd.org: Use .Nm instead of @NAME@. It fixes a strange formatting error. 2000-11-08 23:19 jmknoble * Imakefile: New version 1.1.1. 2000-11-08 23:19 jmknoble * x11-ssh-askpass.c: Fixed problem where inputTimeout of '0' was considered invalid due to bad octal conversion. Fixed small potential memory leak. 2000-11-07 06:20 jmknoble * Imakefile: Bumped version to 1.1.0. 2000-11-07 06:20 jmknoble * TODO: Added notes about recently done stuff (that's what todo lists are for, isn't it?;). 2000-11-07 06:16 jmknoble * SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad: Added new '*inputTimeout' resource, with explanatory comment. 2000-11-07 06:15 jmknoble * x11-ssh-askpass.man.in: Documented new '*inputTimeout' resource. 2000-11-07 06:15 jmknoble * x11-ssh-askpass.c: Fixed a few warnings, commented another. Print message to stderr when we time out, so as not to completely confuse the user. 2000-11-07 05:42 jmknoble * x11-ssh-askpass.c, x11-ssh-askpass.h: Did stuff to handle timing out if no input received. In particular, this required changing XNextEvent() in main application loop to XtAppNextEvent(). May make this larger and more cumbersome.... Also did stuff to make the button labels shift down and to the right when pressed if they're drawn with 3D shading/highlighting, so that they actually *look* pressed. Finally, added code to handle MotionNotify events, so that buttons don't continue to look pressed if the pointer button is pressed, but the pointer is outside the button. Wheeeee! Now we have an actual user interface! 2000-11-07 05:23 jmknoble * SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad: Converted colors from old-style "#rrggbb" to new-style "rgb:rr/gg/bb". Corrected typo in perspicacious commentary. 2000-10-30 05:28 jmknoble * Imakefile: Bumped version to 1.0.3. 2000-10-30 05:28 jmknoble * SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad: Added resources used for pseudo-resolution-independence, along with default values and long, drawn out, but mildly fulfilling explanation. 2000-10-30 05:27 jmknoble * x11-ssh-askpass.man.in: Documented the new resources for pseudo-resolution-independence (defaultXResolution, defaultYResolution, xResolutionFuzz, and yResolutionFuzz). 2000-10-30 05:25 jmknoble * x11-ssh-askpass.c, x11-ssh-askpass.h: Added a small amount of resolution-independence to the dialog widgets. Now we detect the actual X and Y resolution the server is running at; and if they're significantly different from the ones our resource settings expect, then we stretch or shrink buttons, indicators, and spacing to fit the actual resolution. Sometimes X11 really makes my stomach hurt.... 2000-09-24 00:51 jmknoble * Imakefile: New version 1.0.2. 2000-09-24 00:43 jmknoble * x11-ssh-askpass.c, x11-ssh-askpass.h: Added process ID to diagnostic/error messages on stderr (helps when more than one ssh-askpass is started, e.g., with a shortcut key and keyboard repeat). Modified keyboard and pointer grabbing so that, if we don't get the keyboard or pointer the first time, we print a helpful message, sleep, and then retry. If we time out without successfully getting the keyboard or pointer, then we fail as before. Combined the logic for grabKeyboard() and grabPointer() into a common function performGrab(). This makes it easier to ensure that the grab/sleep logic is correct in both places. Fixed, worked around or commented on a few warnings emitted by 'gcc -Wall -W -ansi -pedantic'. 2000-09-24 00:32 jmknoble * resources.c: Removed unused declaration of get_time_resource. 2000-08-28 03:35 jmknoble * Imakefile, TODO: Added TODO file for listing potential future projects within x11-ssh-askpass. 2000-08-28 03:35 jmknoble * README: Added 'make install.man' to installation instructions. Formulated better wording for reference to (now ancient) Perl/Tk ssh-askpass. 2000-08-28 03:26 jmknoble * Imakefile, x11-ssh-askpass.man.in: Added facilities to Imakefile and man page to automatically insert name, date, and version into man page. Changed install target to include man page. Rearranged clean and dist targets slightly. Ready for release. 2000-08-28 02:54 jmknoble * x11-ssh-askpass.man.in: Added corrections and clarifications: Mentioned optional label on command line; noted which toolkit options are unsupported; and added extra indicator-specific resources. 2000-08-28 02:00 jmknoble * x11-ssh-askpass.c: Moved saving of argc/argv to after call to XtAppInitialize(), so that toolkit arguments get properly removed from the argument list. 2000-08-28 01:43 jmknoble * x11-ssh-askpass.man.in: Changed author email address from pobox.com to jmknoble.cx. Added 2000 to copyright date. 2000-08-28 01:42 jmknoble * x11-ssh-askpass.man.in: Added man page for x11-ssh-askpass from Matthieu Herrb of OpenBSD. 2000-08-28 01:31 jmknoble * README, SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad, dynlist.c, dynlist.h, x11-ssh-askpass.c, x11-ssh-askpass.h: Changed ISO-8859-1 copyright character '©' to ASCII '(C)'. 2000-08-28 01:27 jmknoble * README, SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad, drawing.c, drawing.h, dynlist.c, dynlist.h, resources.c, resources.h, x11-ssh-askpass.c, x11-ssh-askpass.h: Changed author email address from pobox.com to jmknoble.cx. Added 2000 to copyright date. 2000-08-28 01:19 jmknoble * x11-ssh-askpass.c: Oops. When the keyboard or pointer grab failed, the fprintf() calls to print the error message were missing the 'reason' argument. Thanks to Daniel Packman . 2000-08-28 01:17 jmknoble * Imakefile: Portability enhancements to Imakefile, suggested by Charles Levert . Use imake's '...Cmd' macros where available; otherwise, use less-nonportable commands. Bumped version to 1.0.1. 2000-01-07 04:53 jmknoble * README: Added note about location of x11-ssh-askpass. 2000-01-07 04:52 jmknoble * Imakefile: Now we install the actual program as `x11-ssh-askpass', and make a symlink to that from `ssh-askpass'. This allows for multiple passphrase dialogs on a system. Bumped version to 1.0. 1999-12-24 01:59 jmknoble * Imakefile: Oops. Version backed out to 0.99; missing spec file for building RPMs. 1999-12-24 01:05 jmknoble * Imakefile: Updated version to 1.0. Removed reference to utils.h. Prefer install targets available in X11R6. 1999-12-24 01:00 jmknoble * README: Updated install directory. Removed reference to utils.h. 1999-12-24 00:58 jmknoble * resources.c, resources.h: Moved header includes from utils.h into resources.c. Trimmed unused functions. 1999-12-24 00:56 jmknoble * dynlist.c: Removed potential memory leak (and ensuing loss of buffer contents) if realloc() failed. 1999-12-24 00:53 jmknoble * utils.h: Moved header includes from here into resources.c. 1999-12-04 23:21 jmknoble * Imakefile: Added patch from Markus Friedl to change use of awk (with GNU-specific extensions?) to sed, more likely to be available on various platforms. 1999-11-23 05:16 jmknoble * .cvsignore: Added ChangeLog to .cvsignore. 1999-11-23 05:14 jmknoble * Imakefile: Added facility for autogenerating ChangeLog using cvs2cl. 1999-11-23 04:57 jmknoble * .cvsignore, README, README.x11-ssh-askpass: README.x11-ssh-askpass moved to README. Shorter. 1999-11-23 04:55 jmknoble * .cvsignore: Added .cvsignore file. 1999-11-23 04:53 jmknoble * Imakefile, SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad, x11-ssh-askpass.c, x11-ssh-askpass.h: - Added version to tarball. - *grab(Keyboard|Pointer|Server) resources had inverted values in app-defaults files. - Futzed with spacing in default and NeXTish themes. - Added setrlimit() call to main() to avoid core dumps. 1999-11-23 04:50 jmknoble * Imakefile, SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad, resources.c, resources.h, x11-ssh-askpass.c, x11-ssh-askpass.h: - Can optionally grab server (*grabServer resource, off by default). - get_pixel_resource(), get_integer_resource() now take default value. - Added minimum/maximum indicator count. - memset() passphrase to 0s before freeing. - Use fputs() instead of printf() to avoid possibility of passphrase getting stored in dynamic memory by stdio. 1999-11-23 04:43 jmknoble * Imakefile, README.x11-ssh-askpass, SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad, drawing.c, drawing.h, dynlist.c, dynlist.h, resources.c, resources.h, utils.h, x11-ssh-askpass.c, x11-ssh-askpass.h: Initial revision 1999-11-23 04:43 jmknoble * Imakefile, README.x11-ssh-askpass, SshAskpass-1337.ad, SshAskpass-NeXTish.ad, SshAskpass-default.ad, SshAskpass-green.ad, SshAskpass-motif.ad, drawing.c, drawing.h, dynlist.c, dynlist.h, resources.c, resources.h, utils.h, x11-ssh-askpass.c, x11-ssh-askpass.h: Begin CVS revision control x11-ssh-askpass-1.2.4.1/Imakefile0100644000135600013560000001122307351324572016535 0ustar jmknoblejmknobleXCOMM Imakefile: How to build x11-ssh-askpass, using xmkmf and then make XCOMM XCOMM by Jim Knoble XCOMM Copyright (C) 1999,2000,2001 Jim Knoble XCOMM XCOMM Disclaimer: XCOMM XCOMM This software is provided "as is", without warranty of any kind, XCOMM express or implied, including but not limited to the warranties of XCOMM merchantability, fitness for a particular purpose and XCOMM noninfringement. In no event shall the author(s) be liable for any XCOMM claim, damages or other liability, whether in an action of XCOMM contract, tort or otherwise, arising from, out of or in connection XCOMM with the software or the use or other dealings in the software. XCOMM XCOMM Permission to use, copy, modify, distribute, and sell this software XCOMM and its documentation for any purpose is hereby granted without XCOMM fee, provided that the above copyright notice appear in all copies XCOMM and that both that copyright notice and this permission notice XCOMM appear in supporting documentation. NAME = x11-ssh-askpass CLASS = SshAskpass XCOMM -------- configurable settings -------- BINDIR = /usr/local/libexec MANPATH = /usr/local/man MANDIR = $(MANPATH)/man1 APPDEFDIR = $(XAPPLOADDIR) APP_DEFAULTS = SshAskpass-default.ad XCOMM CC = XCOMM CDEBUGFLAGS = XCOMM LOCAL_LDFLAGS = XCOMM -------- end configurable settings -------- #ifndef CpCmd # define CpCmd cp #endif #ifndef GzipCmd # define GzipCmd gzip #endif #ifndef LnCmd # if HasSymLinks # define LnCmd ln -s # else # define LnCmd ln # endif #endif #ifndef MvCmd # define MvCmd mv -f #endif #ifndef RmCmd # define RmCmd rm -f #endif CAT = cat CHMOD = chmod CP = CpCmd GREP = grep GZIP = GzipCmd LN = LnCmd MKDIR = MkdirHierCmd MV = MvCmd RM = RmCmd SED = sed TAR = tar MAKE_CHANGELOG = cvs2cl VERSION = 1.2.4.1 DATE = September 17, 2001 PROJECT = $(NAME)-$(VERSION) DIST_DIR = $(PROJECT) DIST = $(PROJECT).tar.gz HDRS = \@@\ drawing.h \@@\ dynlist.h \@@\ resources.h \@@\ x11-ssh-askpass.h SRCS = \@@\ drawing.c \@@\ dynlist.c \@@\ resources.c \@@\ x11-ssh-askpass.c OBJS = \@@\ drawing.o \@@\ dynlist.o \@@\ resources.o \@@\ x11-ssh-askpass.o MAN_OBJ = $(NAME).man MAN_SRC = $(MAN_OBJ).in MANS = $(MAN_SRC) CHANGELOG = ChangeLog CONFIGURE = configure IMAKEFILE_OBJ = Imakefile IMAKEFILE_SRC = $(IMAKEFILE_OBJ).in IMAKEFILES = $(IMAKEFILE_SRC) DOCS = \@@\ README \@@\ TODO APP_DEFAULTS_FILES = \@@\ $(CLASS)-1337.ad \@@\ $(CLASS)-NeXTish.ad \@@\ $(CLASS)-green.ad \@@\ $(CLASS)-motif.ad \@@\ $(CLASS)-default.ad \@@\ DIST_FILES = \@@\ $(IMAKEFILES) \@@\ $(CONFIGURE) \@@\ $(DOCS) \@@\ $(APP_DEFAULTS_FILES) \@@\ $(MANS) \@@\ $(SRCS) \@@\ $(HDRS) DIST_EXTRAS = \@@\ $(CHANGELOG) \@@\ $(IMAKEFILE_OBJ) LOCAL_LIBRARIES = -lXt -lX11 -lSM -lICE ComplexProgramTarget($(NAME)) install:: install-app-defaults install-app-defaults: $(CLASS).ad @if [ -d $(DESTDIR)$(APPDEFDIR) ]; then set +x; \@@\ else (set -x; $(MKDIRHIER) $(DESTDIR)$(APPDEFDIR)); fi $(INSTALL) $(INSTALLFLAGS) $(INSTAPPFLAGS) $(CLASS).ad \@@\ $(DESTDIR)$(APPDEFDIR)/$(CLASS) install:: @set -x; \@@\ if [ -f $(DESTDIR)$(BINDIR)/ssh-askpass ]; then \@@\ $(MV) $(DESTDIR)$(BINDIR)/ssh-askpass \@@\ $(DESTDIR)$(BINDIR)/ssh-askpass.old; \@@\ fi $(LN) $(NAME) $(DESTDIR)$(BINDIR)/ssh-askpass install.man:: @set -x; \@@\ if [ -f $(DESTDIR)$(MANDIR)/ssh-askpass.$(MANSUFFIX) ]; then \@@\ $(MV) $(DESTDIR)$(MANDIR)/ssh-askpass.$(MANSUFFIX) \@@\ $(DESTDIR)$(MANDIR)/ssh-askpass.$(MANSUFFIX).old; \@@\ fi $(LN) $(NAME).$(MANSUFFIX) $(DESTDIR)$(MANDIR)/ssh-askpass.$(MANSUFFIX) .PHONY: depends changelog realclean squeakyclean spotless tar dist all:: $(MAN_OBJ) $(MAN_OBJ): $(MAN_SRC) $(IMAKEFILE_SRC) $(SED) \@@\ -e 's#@NAME@#$(NAME)#g' \@@\ -e 's#@VERSION@#$(VERSION)#g' \@@\ -e 's#@DATE@#$(DATE)#g' \@@\ <$(MAN_SRC) >$@.tmp $(MV) $@.tmp $@ depends: depend includes:: $(CLASS)_ad.h $(CLASS).ad: $(LN) $(APP_DEFAULTS) $(CLASS).ad $(CLASS)_ad.h: $(CLASS).ad $(SED) -n '/^[^!]/s/.*/"&",/p' <$(CLASS).ad >$@.tmp $(MV) $@.tmp $@ changelog: $(CHANGELOG) $(CHANGELOG): $(DIST_FILES) $(MAKE_CHANGELOG) $(IMAKEFILE_OBJ): $(IMAKEFILE_SRC) ./$(CONFIGURE) --defaults clean:: -$(RM) $(CLASS)_ad.h $(MAN_OBJ) realclean: clean -$(RM) $(CLASS).ad -$(RM) *.LOG *.log squeakyclean: realclean -$(RM) Makefile Makefile.bak $(IMAKEFILE_OBJ) $(CHANGELOG) spotless: squeakyclean -$(RM) $(DIST) tar: dist dist: $(DIST) $(DIST): $(DIST_EXTRAS) $(DIST_FILES) -$(RM) -r $(DIST_DIR) -$(RM) $@.tmp $(MKDIR) $(DIST_DIR) $(CP) $(DIST_EXTRAS) $(DIST_FILES) $(DIST_DIR)/ $(CHMOD) -R u+rwX,go+rX,go-w $(DIST_DIR) $(TAR) -cvf - $(DIST_DIR) |$(GZIP) -9 -c >$@.tmp $(MV) $@.tmp $@ -$(RM) -r $(DIST_DIR) x11-ssh-askpass-1.2.4.1/Imakefile.in0100644000135600013560000001122107351324572017140 0ustar jmknoblejmknobleXCOMM Imakefile: How to build x11-ssh-askpass, using xmkmf and then make XCOMM XCOMM by Jim Knoble XCOMM Copyright (C) 1999,2000,2001 Jim Knoble XCOMM XCOMM Disclaimer: XCOMM XCOMM This software is provided "as is", without warranty of any kind, XCOMM express or implied, including but not limited to the warranties of XCOMM merchantability, fitness for a particular purpose and XCOMM noninfringement. In no event shall the author(s) be liable for any XCOMM claim, damages or other liability, whether in an action of XCOMM contract, tort or otherwise, arising from, out of or in connection XCOMM with the software or the use or other dealings in the software. XCOMM XCOMM Permission to use, copy, modify, distribute, and sell this software XCOMM and its documentation for any purpose is hereby granted without XCOMM fee, provided that the above copyright notice appear in all copies XCOMM and that both that copyright notice and this permission notice XCOMM appear in supporting documentation. NAME = x11-ssh-askpass CLASS = SshAskpass XCOMM -------- configurable settings -------- BINDIR = /usr/local/libexec MANPATH = /usr/local/man MANDIR = $(MANPATH)/man1 APPDEFDIR = $(XAPPLOADDIR) APP_DEFAULTS = $(CLASS)-default.ad XCOMM CC = XCOMM CDEBUGFLAGS = XCOMM LOCAL_LDFLAGS = XCOMM -------- end configurable settings -------- #ifndef CpCmd # define CpCmd cp #endif #ifndef GzipCmd # define GzipCmd gzip #endif #ifndef LnCmd # if HasSymLinks # define LnCmd ln -s # else # define LnCmd ln # endif #endif #ifndef MvCmd # define MvCmd mv -f #endif #ifndef RmCmd # define RmCmd rm -f #endif CAT = cat CHMOD = chmod CP = CpCmd GREP = grep GZIP = GzipCmd LN = LnCmd MKDIR = MkdirHierCmd MV = MvCmd RM = RmCmd SED = sed TAR = tar MAKE_CHANGELOG = cvs2cl VERSION = 1.2.4.1 DATE = September 17, 2001 PROJECT = $(NAME)-$(VERSION) DIST_DIR = $(PROJECT) DIST = $(PROJECT).tar.gz HDRS = \@@\ drawing.h \@@\ dynlist.h \@@\ resources.h \@@\ x11-ssh-askpass.h SRCS = \@@\ drawing.c \@@\ dynlist.c \@@\ resources.c \@@\ x11-ssh-askpass.c OBJS = \@@\ drawing.o \@@\ dynlist.o \@@\ resources.o \@@\ x11-ssh-askpass.o MAN_OBJ = $(NAME).man MAN_SRC = $(MAN_OBJ).in MANS = $(MAN_SRC) CHANGELOG = ChangeLog CONFIGURE = configure IMAKEFILE_OBJ = Imakefile IMAKEFILE_SRC = $(IMAKEFILE_OBJ).in IMAKEFILES = $(IMAKEFILE_SRC) DOCS = \@@\ README \@@\ TODO APP_DEFAULTS_FILES = \@@\ $(CLASS)-1337.ad \@@\ $(CLASS)-NeXTish.ad \@@\ $(CLASS)-green.ad \@@\ $(CLASS)-motif.ad \@@\ $(CLASS)-default.ad \@@\ DIST_FILES = \@@\ $(IMAKEFILES) \@@\ $(CONFIGURE) \@@\ $(DOCS) \@@\ $(APP_DEFAULTS_FILES) \@@\ $(MANS) \@@\ $(SRCS) \@@\ $(HDRS) DIST_EXTRAS = \@@\ $(CHANGELOG) \@@\ $(IMAKEFILE_OBJ) LOCAL_LIBRARIES = -lXt -lX11 -lSM -lICE ComplexProgramTarget($(NAME)) install:: install-app-defaults install-app-defaults: $(CLASS).ad @if [ -d $(DESTDIR)$(APPDEFDIR) ]; then set +x; \@@\ else (set -x; $(MKDIRHIER) $(DESTDIR)$(APPDEFDIR)); fi $(INSTALL) $(INSTALLFLAGS) $(INSTAPPFLAGS) $(CLASS).ad \@@\ $(DESTDIR)$(APPDEFDIR)/$(CLASS) install:: @set -x; \@@\ if [ -f $(DESTDIR)$(BINDIR)/ssh-askpass ]; then \@@\ $(MV) $(DESTDIR)$(BINDIR)/ssh-askpass \@@\ $(DESTDIR)$(BINDIR)/ssh-askpass.old; \@@\ fi $(LN) $(NAME) $(DESTDIR)$(BINDIR)/ssh-askpass install.man:: @set -x; \@@\ if [ -f $(DESTDIR)$(MANDIR)/ssh-askpass.$(MANSUFFIX) ]; then \@@\ $(MV) $(DESTDIR)$(MANDIR)/ssh-askpass.$(MANSUFFIX) \@@\ $(DESTDIR)$(MANDIR)/ssh-askpass.$(MANSUFFIX).old; \@@\ fi $(LN) $(NAME).$(MANSUFFIX) $(DESTDIR)$(MANDIR)/ssh-askpass.$(MANSUFFIX) .PHONY: depends changelog realclean squeakyclean spotless tar dist all:: $(MAN_OBJ) $(MAN_OBJ): $(MAN_SRC) $(IMAKEFILE_SRC) $(SED) \@@\ -e 's#@NAME@#$(NAME)#g' \@@\ -e 's#@VERSION@#$(VERSION)#g' \@@\ -e 's#@DATE@#$(DATE)#g' \@@\ <$(MAN_SRC) >$@.tmp $(MV) $@.tmp $@ depends: depend includes:: $(CLASS)_ad.h $(CLASS).ad: $(LN) $(APP_DEFAULTS) $(CLASS).ad $(CLASS)_ad.h: $(CLASS).ad $(SED) -n '/^[^!]/s/.*/"&",/p' <$(CLASS).ad >$@.tmp $(MV) $@.tmp $@ changelog: $(CHANGELOG) $(CHANGELOG): $(DIST_FILES) $(MAKE_CHANGELOG) $(IMAKEFILE_OBJ): $(IMAKEFILE_SRC) ./$(CONFIGURE) --defaults clean:: -$(RM) $(CLASS)_ad.h $(MAN_OBJ) realclean: clean -$(RM) $(CLASS).ad -$(RM) *.LOG *.log squeakyclean: realclean -$(RM) Makefile Makefile.bak $(IMAKEFILE_OBJ) $(CHANGELOG) spotless: squeakyclean -$(RM) $(DIST) tar: dist dist: $(DIST) $(DIST): $(DIST_EXTRAS) $(DIST_FILES) -$(RM) -r $(DIST_DIR) -$(RM) $@.tmp $(MKDIR) $(DIST_DIR) $(CP) $(DIST_EXTRAS) $(DIST_FILES) $(DIST_DIR)/ $(CHMOD) -R u+rwX,go+rX,go-w $(DIST_DIR) $(TAR) -cvf - $(DIST_DIR) |$(GZIP) -9 -c >$@.tmp $(MV) $@.tmp $@ -$(RM) -r $(DIST_DIR) x11-ssh-askpass-1.2.4.1/configure0100755000135600013560000001672407351324572016646 0ustar jmknoblejmknoble#!/bin/sh # # configure: Automatically configure install locations for x11-ssh-askpass # # by Jim Knoble # Copyright (C) 2001 Jim Knoble # # Disclaimer: # # This software is provided "as is", without warranty of any kind, # express or implied, including but not limited to the warranties of # merchantability, fitness for a particular purpose and # noninfringement. In no event shall the author(s) be liable for any # claim, damages or other liability, whether in an action of # contract, tort or otherwise, arising from, out of or in connection # with the software or the use or other dealings in the software. # # Permission to use, copy, modify, distribute, and sell this software # and its documentation for any purpose is hereby granted without # fee, provided that the above copyright notice appear in all copies # and that both that copyright notice and this permission notice # appear in supporting documentation. PrintHelp() { cat <"${IMAKEFILE_DST}.tmp" \ && mv -f "${IMAKEFILE_DST}.tmp" "${IMAKEFILE_DST}" case "${enable_installing_app_defaults}" in yes) cat "${IMAKEFILE_DST}" |sed \ -e 's#^[ ]*\(XCOMM[ ]\+\)\?\(install::[ ]\+install-app-defaults.*\)$#\2#' \ >"${IMAKEFILE_DST}.tmp" \ && mv -f "${IMAKEFILE_DST}.tmp" "${IMAKEFILE_DST}" ;; no) cat "${IMAKEFILE_DST}" |sed \ -e 's#^[ ]*\(XCOMM[ ]\+\)\?\(install::[ ]\+install-app-defaults.*\)$#XCOMM \2#' \ >"${IMAKEFILE_DST}.tmp" \ && mv -f "${IMAKEFILE_DST}.tmp" "${IMAKEFILE_DST}" ;; esac if [ -n "${CC}" ]; then cat "${IMAKEFILE_DST}" |sed \ -e 's#^[ ]*XCOMM[ ]\+\(CC[ ]*=\).*$#\1 '"${CC}"'#' \ >"${IMAKEFILE_DST}.tmp" \ && mv -f "${IMAKEFILE_DST}.tmp" "${IMAKEFILE_DST}" else CC='default' fi if [ -n "${CFLAGS}" ]; then cat "${IMAKEFILE_DST}" |sed \ -e 's#^[ ]*XCOMM[ ]\+\(CDEBUGFLAGS[ ]*=\).*$#\1 '"${CFLAGS}"'#' \ >"${IMAKEFILE_DST}.tmp" \ && mv -f "${IMAKEFILE_DST}.tmp" "${IMAKEFILE_DST}" else CFLAGS='default' fi if [ -n "${LDFLAGS}" ]; then cat "${IMAKEFILE_DST}" |sed \ -e 's#^[ ]*XCOMM[ ]\+\(LOCAL_LDFLAGS[ ]*=\).*$#\1 '"${LDFLAGS}"'#' \ >"${IMAKEFILE_DST}.tmp" \ && mv -f "${IMAKEFILE_DST}.tmp" "${IMAKEFILE_DST}" else LDFLAGS='default' fi if [ "${app_defaults_dir}" = "${default_default_app_defaults_dir}" ]; then app_defaults_dir='default' fi cat <, while others are original works. The contents of the following files is taken directly, in whole or in part, from xscreensaver: drawing.c drawing.h resources.c resources.h The contents of the following files contains a limited amount of code (less than approximately 25%) which is derived from portions of xscreensaver: x11-ssh-askpass.c The remainder of the code is an original work, including the following files: dynlist.c dynlist.h x11-ssh-askpass.h *.ad The portions derived from xscreensaver require the following notice: xscreensaver, Copyright (c) 1991-1999 Jamie Zawinski Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. The remaining portions fall under the following copyright and license: by Jim Knoble Copyright (C) 1999,2000,2001 Jim Knoble Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. +------------+ | Disclaimer | +------------+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the author(s) be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software. -------- End of file -------- x11-ssh-askpass-1.2.4.1/TODO0100644000135600013560000000114507351324572015416 0ustar jmknoblejmknoble# TODO: Notes about future work on x11-ssh-askpass # created 2000-Aug-28 03:32 jmk # autodate: 2001-Apr-01 17:40 +------------+ | Fun Things | +------------+ - (DONE) Add timeout feature. +---------------+ | High Priority | +---------------+ No items. +--------------+ | Low Priority | +--------------+ - (DONE) Make pressed buttons actually look pressed. - (DONE) Make pressed buttons pop back up when the pointer leaves them. - (DONE) Investigate use of malloc() vs realloc(NULL,) for SunOS and other older systems. Charles Levert and Steve VanDevender . x11-ssh-askpass-1.2.4.1/SshAskpass-1337.ad0100644000135600013560000000723607351324572017721 0ustar jmknoblejmknoble! SshAskpass.ad: Default resources for the X11-based ssh-askpass for OpenSSH ! created 1999-Nov-17 03:40 Jim Knoble ! autodate: 2001-Sep-16 18:07 ! ! by Jim Knoble ! Copyright (C) 1999,2000 Jim Knoble ! ! Disclaimer: ! ! The software is provided "as is", without warranty of any kind, ! express or implied, including but not limited to the warranties of ! merchantability, fitness for a particular purpose and ! noninfringement. In no event shall the author(s) be liable for any ! claim, damages or other liability, whether in an action of ! contract, tort or otherwise, arising from, out of or in connection ! with the software or the use or other dealings in the software. ! ! Permission to use, copy, modify, distribute, and sell this software ! and its documentation for any purpose is hereby granted without ! fee, provided that the above copyright notice appear in all copies ! and that both that copyright notice and this permission notice ! appear in supporting documentation. ! ! +-------------+ ! | e133t theme | ! +-------------+ *Dialog.font: -b&h-lucida-medium-r-normal-*-*-100-*-*-*-*-iso8859-1 *?.foreground: rgb:d0/d0/d0 *?.background: rgb:50/50/50 *topShadowColor: rgb:90/90/90 *bottomShadowColor: rgb:00/00/00 *borderColor: rgb:a0/a0/a0 *shadowThickness: 2 *borderWidth: 1 *horizontalSpacing: 5 *verticalSpacing: 5 *Button.font: -b&h-lucida-medium-r-normal-*-*-100-*-*-*-*-iso8859-1 *Button.shadowThickness: 1 *Button.borderWidth: 0 *Button.horizontalSpacing: 4 *Button.verticalSpacing: 2 *Indicator.foreground: rgb:70/80/90 *Indicator.background: rgb:50/50/50 *Indicator.shadowThickness: 1 *Indicator.borderWidth: 0 *Indicator.height: 4 *Indicator.width: 13 *Indicator.horizontalSpacing: 4 *Indicator.verticalSpacing: 5 *Indicator.minimumCount: 8 *Indicator.maximumCount: 24 ! X11 does a miserable job of providing resolution-independent drawing ! facilities---it expects everything to be done in pixels. So if you ! happen to run your X server at a resolution of 100 pixels per inch ! (or some other strange value) instead of the widely used default of ! 75, x11-ssh-askpass looks might tiny. [Sigh]. ! ! To get around this, umm, limitation, we declare the resolution that ! the spacing and width/height pixels values are "valid" for, along ! with a fuzz factor. If the current actual resolution is outside of ! the range of .., then we scale pixel ! measurements to fit the actual resolution. ! ! (And if you think *this* is a horrid hack, then take a look at the ! actual code, which has to deal with conversion to [cheesy fanfare] ! that's right---millimeters!!! The right hand managed to slip that ! one in while the left hand was adding a '-dpi' switch to the sample ! server implementation. I think both left feet were adding the ! RESOLUTION_X and RESOLUTION_Y fields [in dots per inch, naturally] ! to the X Logical Font Description. The irony is underwhelming.) *defaultXResolution: 75/in *defaultYResolution: 75/in *xResolutionFuzz: 20/in *yResolutionFuzz: 20/in ! Number of seconds to wait for a key- or button-press ! before giving up. '0' means wait forever. *inputTimeout: 0 ! Ssh-askpass grabs the keyboard by default. ! To stop it from grabbing the keyboard, use: !*grabKeyboard: false ! Ssh-askpass does not grab the pointer by default. ! To make it grab the pointer, use: !*grabPointer: true ! Ssh-askpass does not grab the server by default. ! To make it grab the server, use: !*grabServer: true *Dialog.title: OpenSSH Authentication Passphrase Request *Dialog.label: Please enter your authentication passphrase: *okButton.label: OK *cancelButton.label: Cancel x11-ssh-askpass-1.2.4.1/SshAskpass-NeXTish.ad0100644000135600013560000000742007351324572020641 0ustar jmknoblejmknoble! SshAskpass.ad: Default resources for the X11-based ssh-askpass for OpenSSH ! created 1999-Nov-17 03:40 Jim Knoble ! autodate: 2001-Sep-16 18:08 ! ! by Jim Knoble ! Copyright (C) 1999,2000 Jim Knoble ! ! Disclaimer: ! ! The software is provided "as is", without warranty of any kind, ! express or implied, including but not limited to the warranties of ! merchantability, fitness for a particular purpose and ! noninfringement. In no event shall the author(s) be liable for any ! claim, damages or other liability, whether in an action of ! contract, tort or otherwise, arising from, out of or in connection ! with the software or the use or other dealings in the software. ! ! Permission to use, copy, modify, distribute, and sell this software ! and its documentation for any purpose is hereby granted without ! fee, provided that the above copyright notice appear in all copies ! and that both that copyright notice and this permission notice ! appear in supporting documentation. ! ! +--------------------+ ! | NEXTstep-ish theme | ! +--------------------+ *Dialog.font: -adobe-helvetica-medium-r-normal-*-*-120-*-*-*-*-iso8859-1 *?.foreground: rgb:00/00/00 *?.background: rgb:a8/a8/a8 *topShadowColor: rgb:ff/ff/ff *bottomShadowColor: rgb:54/54/54 *borderColor: rgb:20/20/20 *shadowThickness: 0 *borderWidth: 1 *horizontalSpacing: 8 *verticalSpacing: 8 *Button.font: -adobe-helvetica-medium-r-normal-*-*-120-*-*-*-*-iso8859-1 *Button.shadowThickness: 1 *Button.borderWidth: 1 *Button.horizontalSpacing: 8 *Button.verticalSpacing: 3 *Indicator.foreground: rgb:9b/cd/9b *Indicator.background: rgb:54/54/54 *Indicator.topShadowColor: rgb:ff/ff/ff *Indicator.bottomShadowColor: rgb:20/20/20 *Indicator.shadowThickness: 1 *Indicator.borderWidth: 0 *Indicator.height: 7 *Indicator.width: 15 *Indicator.horizontalSpacing: 4 *Indicator.verticalSpacing: 6 *Indicator.minimumCount: 8 *Indicator.maximumCount: 24 ! X11 does a miserable job of providing resolution-independent drawing ! facilities---it expects everything to be done in pixels. So if you ! happen to run your X server at a resolution of 100 pixels per inch ! (or some other strange value) instead of the widely used default of ! 75, x11-ssh-askpass looks might tiny. [Sigh]. ! ! To get around this, umm, limitation, we declare the resolution that ! the spacing and width/height pixels values are "valid" for, along ! with a fuzz factor. If the current actual resolution is outside of ! the range of .., then we scale pixel ! measurements to fit the actual resolution. ! ! (And if you think *this* is a horrid hack, then take a look at the ! actual code, which has to deal with conversion to [cheesy fanfare] ! that's right---millimeters!!! The right hand managed to slip that ! one in while the left hand was adding a '-dpi' switch to the sample ! server implementation. I think both left feet were adding the ! RESOLUTION_X and RESOLUTION_Y fields [in dots per inch, naturally] ! to the X Logical Font Description. The irony is underwhelming.) *defaultXResolution: 75/in *defaultYResolution: 75/in *xResolutionFuzz: 20/in *yResolutionFuzz: 20/in ! Number of seconds to wait for a key- or button-press ! before giving up. '0' means wait forever. *inputTimeout: 0 ! Ssh-askpass grabs the keyboard by default. ! To stop it from grabbing the keyboard, use: !*grabKeyboard: false ! Ssh-askpass does not grab the pointer by default. ! To make it grab the pointer, use: !*grabPointer: true ! Ssh-askpass does not grab the server by default. ! To make it grab the server, use: !*grabServer: true *Dialog.title: OpenSSH Authentication Passphrase Request *Dialog.label: Please enter your authentication passphrase: *okButton.label: OK *cancelButton.label: Cancel x11-ssh-askpass-1.2.4.1/SshAskpass-green.ad0100644000135600013560000000727607351324572020430 0ustar jmknoblejmknoble! SshAskpass.ad: Default resources for the X11-based ssh-askpass for OpenSSH ! created 1999-Nov-17 03:40 Jim Knoble ! autodate: 2001-Sep-16 18:07 ! ! by Jim Knoble ! Copyright (C) 1999,2000 Jim Knoble ! ! Disclaimer: ! ! The software is provided "as is", without warranty of any kind, ! express or implied, including but not limited to the warranties of ! merchantability, fitness for a particular purpose and ! noninfringement. In no event shall the author(s) be liable for any ! claim, damages or other liability, whether in an action of ! contract, tort or otherwise, arising from, out of or in connection ! with the software or the use or other dealings in the software. ! ! Permission to use, copy, modify, distribute, and sell this software ! and its documentation for any purpose is hereby granted without ! fee, provided that the above copyright notice appear in all copies ! and that both that copyright notice and this permission notice ! appear in supporting documentation. ! ! +-------------+ ! | Green theme | ! +-------------+ *Dialog.font: -adobe-new century schoolbook-bold-r-normal-*-*-140-*-*-*-*-iso8859-1 *?.foreground: rgb:54/ff/9f *?.background: rgb:2e/8b/57 *topShadowColor: rgb:43/cd/80 *bottomShadowColor: rgb:43/cd/80 *borderColor: rgb:43/cd/80 *shadowThickness: 2 *borderWidth: 0 *horizontalSpacing: 5 *verticalSpacing: 6 *Button.font: -adobe-new century schoolbook-bold-r-normal-*-*-140-*-*-*-*-iso8859-1 *Button.shadowThickness: 0 *Button.borderWidth: 2 *Button.horizontalSpacing: 4 *Button.verticalSpacing: 2 *Indicator.foreground: rgb:ad/ff/2f *Indicator.background: rgb:2e/8b/57 *Indicator.shadowThickness: 0 *Indicator.borderWidth: 2 *Indicator.height: 7 *Indicator.width: 15 *Indicator.horizontalSpacing: 3 *Indicator.verticalSpacing: 4 *Indicator.minimumCount: 8 *Indicator.maximumCount: 24 ! X11 does a miserable job of providing resolution-independent drawing ! facilities---it expects everything to be done in pixels. So if you ! happen to run your X server at a resolution of 100 pixels per inch ! (or some other strange value) instead of the widely used default of ! 75, x11-ssh-askpass looks might tiny. [Sigh]. ! ! To get around this, umm, limitation, we declare the resolution that ! the spacing and width/height pixels values are "valid" for, along ! with a fuzz factor. If the current actual resolution is outside of ! the range of .., then we scale pixel ! measurements to fit the actual resolution. ! ! (And if you think *this* is a horrid hack, then take a look at the ! actual code, which has to deal with conversion to [cheesy fanfare] ! that's right---millimeters!!! The right hand managed to slip that ! one in while the left hand was adding a '-dpi' switch to the sample ! server implementation. I think both left feet were adding the ! RESOLUTION_X and RESOLUTION_Y fields [in dots per inch, naturally] ! to the X Logical Font Description. The irony is underwhelming.) *defaultXResolution: 75/in *defaultYResolution: 75/in *xResolutionFuzz: 20/in *yResolutionFuzz: 20/in ! Number of seconds to wait for a key- or button-press ! before giving up. '0' means wait forever. *inputTimeout: 0 ! Ssh-askpass grabs the keyboard by default. ! To stop it from grabbing the keyboard, use: !*grabKeyboard: false ! Ssh-askpass does not grab the pointer by default. ! To make it grab the pointer, use: !*grabPointer: true ! Ssh-askpass does not grab the server by default. ! To make it grab the server, use: !*grabServer: true *Dialog.title: OpenSSH Authentication Passphrase Request *Dialog.label: Please enter your authentication passphrase: *okButton.label: OK *cancelButton.label: Cancel x11-ssh-askpass-1.2.4.1/SshAskpass-motif.ad0100644000135600013560000000726007351324572020437 0ustar jmknoblejmknoble! SshAskpass.ad: Default resources for the X11-based ssh-askpass for OpenSSH ! created 1999-Nov-17 03:40 Jim Knoble ! autodate: 2001-Sep-16 18:07 ! ! by Jim Knoble ! Copyright (C) 1999,2000 Jim Knoble ! ! Disclaimer: ! ! The software is provided "as is", without warranty of any kind, ! express or implied, including but not limited to the warranties of ! merchantability, fitness for a particular purpose and ! noninfringement. In no event shall the author(s) be liable for any ! claim, damages or other liability, whether in an action of ! contract, tort or otherwise, arising from, out of or in connection ! with the software or the use or other dealings in the software. ! ! Permission to use, copy, modify, distribute, and sell this software ! and its documentation for any purpose is hereby granted without ! fee, provided that the above copyright notice appear in all copies ! and that both that copyright notice and this permission notice ! appear in supporting documentation. ! ! +-----------------+ ! | Motif-ish theme | ! +-----------------+ *Dialog.font: -adobe-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-1 *?.foreground: rgb:00/00/00 *?.background: rgb:c0/c0/c0 *topShadowColor: rgb:e5/e5/e5 *bottomShadowColor: rgb:69/69/69 *borderColor: rgb:00/00/00 *shadowThickness: 2 *borderWidth: 0 *horizontalSpacing: 8 *verticalSpacing: 6 *Button.font: -adobe-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-1 *Button.shadowThickness: 2 *Button.borderWidth: 0 *Button.horizontalSpacing: 5 *Button.verticalSpacing: 4 *Indicator.foreground: rgb:ff/ff/70 *Indicator.background: rgb:4f/94/cd *Indicator.shadowThickness: 2 *Indicator.borderWidth: 0 *Indicator.height: 7 *Indicator.width: 15 *Indicator.horizontalSpacing: 3 *Indicator.verticalSpacing: 6 *Indicator.minimumCount: 8 *Indicator.maximumCount: 24 ! X11 does a miserable job of providing resolution-independent drawing ! facilities---it expects everything to be done in pixels. So if you ! happen to run your X server at a resolution of 100 pixels per inch ! (or some other strange value) instead of the widely used default of ! 75, x11-ssh-askpass looks might tiny. [Sigh]. ! ! To get around this, umm, limitation, we declare the resolution that ! the spacing and width/height pixels values are "valid" for, along ! with a fuzz factor. If the current actual resolution is outside of ! the range of .., then we scale pixel ! measurements to fit the actual resolution. ! ! (And if you think *this* is a horrid hack, then take a look at the ! actual code, which has to deal with conversion to [cheesy fanfare] ! that's right---millimeters!!! The right hand managed to slip that ! one in while the left hand was adding a '-dpi' switch to the sample ! server implementation. I think both left feet were adding the ! RESOLUTION_X and RESOLUTION_Y fields [in dots per inch, naturally] ! to the X Logical Font Description. The irony is underwhelming.) *defaultXResolution: 75/in *defaultYResolution: 75/in *xResolutionFuzz: 20/in *yResolutionFuzz: 20/in ! Number of seconds to wait for a key- or button-press ! before giving up. '0' means wait forever. *inputTimeout: 0 ! Ssh-askpass grabs the keyboard by default. ! To stop it from grabbing the keyboard, use: !*grabKeyboard: false ! Ssh-askpass does not grab the pointer by default. ! To make it grab the pointer, use: !*grabPointer: true ! Ssh-askpass does not grab the server by default. ! To make it grab the server, use: !*grabServer: true *Dialog.title: OpenSSH Authentication Passphrase Request *Dialog.label: Please enter your authentication passphrase: *okButton.label: OK *cancelButton.label: Cancel x11-ssh-askpass-1.2.4.1/SshAskpass-default.ad0100644000135600013560000000732407351324572020746 0ustar jmknoblejmknoble! SshAskpass.ad: Default resources for the X11-based ssh-askpass for OpenSSH ! created 1999-Nov-17 03:40 Jim Knoble ! autodate: 2001-Sep-16 18:08 ! ! by Jim Knoble ! Copyright (C) 1999,2000 Jim Knoble ! ! Disclaimer: ! ! The software is provided "as is", without warranty of any kind, ! express or implied, including but not limited to the warranties of ! merchantability, fitness for a particular purpose and ! noninfringement. In no event shall the author(s) be liable for any ! claim, damages or other liability, whether in an action of ! contract, tort or otherwise, arising from, out of or in connection ! with the software or the use or other dealings in the software. ! ! Permission to use, copy, modify, distribute, and sell this software ! and its documentation for any purpose is hereby granted without ! fee, provided that the above copyright notice appear in all copies ! and that both that copyright notice and this permission notice ! appear in supporting documentation. ! ! +-----------------------------+ ! | Default theme (like SSH v1) | ! +-----------------------------+ *Dialog.font: -adobe-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-1 *?.foreground: rgb:00/00/00 *?.background: rgb:cc/cc/cc *topShadowColor: rgb:ff/ff/ff *bottomShadowColor: rgb:7f/7f/7f *borderColor: rgb:20/20/20 *shadowThickness: 3 *borderWidth: 1 *horizontalSpacing: 5 *verticalSpacing: 6 *Button.font: -adobe-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-1 *Button.shadowThickness: 2 *Button.borderWidth: 1 *Button.horizontalSpacing: 5 *Button.verticalSpacing: 2 *Indicator.foreground: rgb:9b/cd/9b *Indicator.background: rgb:00/00/80 *Indicator.shadowThickness: 2 *Indicator.borderWidth: 0 *Indicator.height: 7 *Indicator.width: 15 *Indicator.horizontalSpacing: 2 *Indicator.verticalSpacing: 4 *Indicator.minimumCount: 8 *Indicator.maximumCount: 24 ! X11 does a miserable job of providing resolution-independent drawing ! facilities---it expects everything to be done in pixels. So if you ! happen to run your X server at a resolution of 100 pixels per inch ! (or some other strange value) instead of the widely used default of ! 75, x11-ssh-askpass looks might tiny. [Sigh]. ! ! To get around this, umm, limitation, we declare the resolution that ! the spacing and width/height pixels values are "valid" for, along ! with a fuzz factor. If the current actual resolution is outside of ! the range of .., then we scale pixel ! measurements to fit the actual resolution. ! ! (And if you think *this* is a horrid hack, then take a look at the ! actual code, which has to deal with conversion to [cheesy fanfare] ! that's right---millimeters!!! The right hand managed to slip that ! one in while the left hand was adding a '-dpi' switch to the sample ! server implementation. I think both left feet were adding the ! RESOLUTION_X and RESOLUTION_Y fields [in dots per inch, naturally] ! to the X Logical Font Description. The irony is underwhelming.) *defaultXResolution: 75/in *defaultYResolution: 75/in *xResolutionFuzz: 20/in *yResolutionFuzz: 20/in ! Number of seconds to wait for a key- or button-press ! before giving up. '0' means wait forever. *inputTimeout: 0 ! Ssh-askpass grabs the keyboard by default. ! To stop it from grabbing the keyboard, use: !*grabKeyboard: false ! Ssh-askpass does not grab the pointer by default. ! To make it grab the pointer, use: !*grabPointer: true ! Ssh-askpass does not grab the server by default. ! To make it grab the server, use: !*grabServer: true *Dialog.title: OpenSSH Authentication Passphrase Request *Dialog.label: Please enter your authentication passphrase: *okButton.label: OK *cancelButton.label: Cancel x11-ssh-askpass-1.2.4.1/x11-ssh-askpass.man.in0100644000135600013560000002252307351324572020702 0ustar jmknoblejmknoble.\" x11-ssh-askpass.man .\" Created by Matthieu Herrb for OpenBSD .\" Modified by Jim Knoble for non-OpenBSD .\" distribution .\" .Dd @DATE@ .Dt @NAME@ 1 .Os "Version @VERSION@" .Sh NAME .Nm @NAME@ .Nd an X11-based pass-phrase dialog for use with OpenSSH .Sh SYNOPSIS .Nm @NAME@ .Op options .Op label .Sh DESCRIPTION .Nm is an X11-based pass-phrase dialog for use with OpenSSH. It is intended to be called from the .Xr ssh-add 1 program and not invoked directly. .Pp .Nm supports most standard Toolkit command line arguments, with the exception of .Ar -geometry , .Ar -borderwidth , .Ar -iconic , .Ar -rv , and .Ar -title . See .Xr X 1 . .Pp If exactly one non-option argument is provided on the command line, it is displayed in the dialog instead of the default label. If the argument contains newline characters ('\\n'), each line of text is displayed on a separate line in the dialog. .Pp The features of .Nm are as follows: .Bl -dash -offset indent .It Configurable via the standard X resource mechanisms .Pa /usr/X11R6/lib/X11/app-defaults , .Pa ~/.Xdefaults , .Xr xrdb 1 , etc. .It Requires only stock X11 libraries (\%libXt, \%libX11, \%libSM, \%libICE). .It Can be configured to grab the keyboard and/or pointer (grabs the keyboard by default, not the pointer). .El .Pp The user interface is somewhat different than most password/pass-phrase dialogs and more similar to the X11-based pass-phrase dialog that accompanies the regular SSH distribution. Instead of a text field that fills with asterisks or some other character as the user enters the pass-phrase, a series of LED-like areas light up one-by-one with each pass-phrase character entered, beginning from the left-hand edge of the dialog. When they reach the right-hand edge, they go dark one-by-one again, and so on. This gives the user feedback that pass-phrase characters have been entered, but does not provide onlookers with a cue as to the length of the pass-phrase. .Pp Pressing the .Sq OK button accepts the pass-phrase (even if it is empty), which is printed on the standard output, and the dialog exits with a status of zero (success). Pressing the .Sq Cancel button discards the pass-phrase, and the dialog exits with non-zero status. .Pp The following keystrokes work as expected: .Bl -tag -width "[Backspace]" -offset indent -compact .Pp .It Bq Backspace .It Bq Delete Erase previous character .Pp .It Bq Control+U .It Bq Control+X Erase entire pass-phrase .Pp .It Bq Enter .It Bq Control+M .It Bq Control+J Accept pass-phrase (OK) .Pp .It Bq Escape Discard pass-phrase (Cancel) .El .Sh WIDGETS The main window of .Nm has the widget hierarchy indicated below. The widget class name is given first, followed by the instance name. .Bl -tag -width "Dialog" -offset indent .It Dialog dialog .Pp .Bl -tag -width "Indicator" -compact .It Indicator indicator .It Button okButton .It Button cancelButton .El .El .Sh RESOURCES The following resources are used to customize the application globally: .Bl -tag -width 2n -offset indent .It Cm grabKeyboard ( No class Cm GrabKeyboard ) .Bl -inset -compact .It specifies if the application should grab the keyboard. .It Default value: .Dq True . .El .It Cm grabPointer ( No class Cm GrabPointer ) .Bl -inset -compact .It specifies if the application should grab the pointer. .It Default value: .Dq False . .El .It Cm grabServer ( No class Cm GrabServer ) .Bl -inset -compact .It specifies if the application should grab the server. .It Default value: .Dq False . .El .It Cm inputTimeout ( No class Cm InputTimeout ) .Bl -inset -compact .It the number of seconds .Nm should wait for a key or button press before it gives up and exits. A timeout of .Dq 0 means wait forever. .It Default value: .Dq 0 . .El .It Cm defaultXResolution ( No class Cm DefaultXResolution ) .Bl -inset -compact .It the number of pixels per unit length that horizontal spacing and width values are intended for. If the actual horizontal (x) resolution of the X server is significantly greater or less than this value, portions of the dialog, indicator, and button widgets are stretched or shrunk horizontally to take the difference into account. The value is a positive integer, followed by a slash .Cm ( / ) and a one- or two-character unit abbreviation. Valid units are inches .Cm ( in or .Cm i ) and meters .Cm ( m ) . .It Default value: .Dq 75/in (75 pixels per inch). .El .It Cm defaultYResolution ( No class Cm DefaultYResolution ) .Bl -inset -compact .It the number of pixels per unit length that vertical spacing and height values are intended for. If the actual vertical (y) resolution of the X server is significantly greater or less than this value, portions of the dialog, indicator, and button widgets are stretched or shrunk vertically to take the difference into account. Valid values are the same as for .Cm defaultXResolution above. .It Default value: .Dq 75/in (75 pixels per inch). .El .It Cm xResolutionFuzz ( No class Cm XResolutionFuzz ) .Bl -inset -compact .It the range of .Dq fuzz around the value of .Cm defaultXResolution beyond which some widgets will be stretched or shrunk horizontally to fit the current actual horizontal resolution. Valid values are the same as for .Cm defaultXResolution . For example, if the default X resolution is .Dq 75/in , and the X resolution fuzz is .Dq 50/in , then widgets won't be scaled horizontally unless the actual horizontal resolution is less than 25 pixels per inch or greater than 125 pixels per inch. .It Default value: .Dq 20/in (20 pixels per inch). .El .It Cm yResolutionFuzz ( No class Cm YResolutionFuzz ) .Bl -inset -compact .It the range of .Dq fuzz around the value of .Cm defaultYResolution beyond which some widgets will be stretched or shrunk vertically to fit the current actual vertical resolution. Valid values are the same as for .Cm defaultXResolution above. .It Default value: .Dq 20/in (20 pixels per inch). .El .El .Pp The following resources are recognized by the Dialog widget: .Bl -tag -width 2n -offset indent .It Cm title ( No class Cm Title ) The title of the application as specified to the window manager. .It Cm label ( No class Cm Label ) The label displayed above the led indicators. .It Cm font ( No class Cm Font ) The font to be used to display the label. .El .Pp The following Resources are recognized by the dialog, button, and indicator widgets and the main widget to customize the 3D appearance (all measurements are in pixels): .Bl -tag -width 2n -offset indent .It Cm foreground ( No class Cm Foreground ) The foreground color of the widget. This is the text color of the label for buttons and dialog and the color of the active led for the indicator. .It Cm background ( No class Cm Background ) The background color of the widget. In the case of the indicator this is the color of the inactive led. .It Cm topShadowColor ( No class Cm TopShadowColor ) The color used by the sides of the widget exposed to the light (top and left). .It Cm bottomShadowColor ( No class Cm BottomShadowColor ) The color used by the sides of the widget in the shadow (right and bottom). .It Cm shadowThickness ( No class Cm ShadowTickness ) The thickness of the 3D border of the widget. .It Cm borderColor ( No class Cm BorderColor ) The color of the border around the widget. .It Cm borderWidth ( No class Cm BorderWidth ) The width of the border around the widget. .It Cm horizontalSpacing ( No class Cm HorizontalSpacing ) The space to leave on left and right sides of the widget. .It Cm verticalSpacing ( No class Cm VerticalSpacing ) The space to leave on top and bottom sides of the widget. .El .Pp The following resources are recognized by the indicator widgets: .Bl -tag -width 2n -offset indent .It Cm minimumCount ( No class Cm MinimumCount ) The minimum number of indicators to display in the dialog. .It Cm maximumCount ( No class Cm MaximumCount ) The maximum number of indicators to display in the dialog. .El .Pp Each button uses the following resources to customize its label: .Bl -tag -width 2n -offset indent .It Cm label ( No class Cm Label ) the string to display on the button. .It Cm font ( No class Cm Font ) the font to use for this button label. .El .Sh FILES .Bl -tag -width "/usr/X11R6/lib/X11/app-defaults/SshAskpass" -compact .It Pa /usr/X11R6/lib/X11/app-defaults/SshAskpass .El .Sh SEE ALSO .Xr X 1 , .Xr ssh 1 , .Xr ssh-agent 1 .Sh LICENSE Some portions of .Nm are derived directly or indirectly from portions of xscreensaver by Jamie Zawinski , while others are original works. .Pp xscreensaver, Copyright \(co 1991-1999 Jamie Zawinski .Aq jwz@jwz.org .Pp Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. .Pp The remaining portions fall under the following copyright and license: .Pp .Nm by Jim Knoble .Aq jmknoble@pobox.com Copyright \(co 1999,2000,2001 Jim Knoble .Pp Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. x11-ssh-askpass-1.2.4.1/drawing.c0100644000135600013560000000500707351324572016526 0ustar jmknoblejmknoble/* xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. No representations are made about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. */ /* 1999-Nov-21 Modified by Jim Knoble * Modifications: * - Extracted draw_shaded_rectangle() from xscreensaver source for use * in a separate application. Constructed separate header file. */ #include void draw_shaded_rectangle (Display *dpy, Window window, int x, int y, int width, int height, int thickness, unsigned long top_color, unsigned long bottom_color) { XPoint points[4]; XGCValues gcv; GC gc1, gc2; if (thickness == 0) return; gcv.foreground = top_color; gc1 = XCreateGC (dpy, window, GCForeground, &gcv); gcv.foreground = bottom_color; gc2 = XCreateGC (dpy, window, GCForeground, &gcv); points [0].x = x; points [0].y = y; points [1].x = x + width; points [1].y = y; points [2].x = x + width - thickness; points [2].y = y + thickness; points [3].x = x; points [3].y = y + thickness; XFillPolygon (dpy, window, gc1, points, 4, Convex, CoordModeOrigin); points [0].x = x; points [0].y = y + thickness; points [1].x = x; points [1].y = y + height; points [2].x = x + thickness; points [2].y = y + height - thickness; points [3].x = x + thickness; points [3].y = y + thickness; XFillPolygon (dpy, window, gc1, points, 4, Convex, CoordModeOrigin); points [0].x = x + width; points [0].y = y; points [1].x = x + width - thickness; points [1].y = y + thickness; points [2].x = x + width - thickness; points [2].y = y + height - thickness; points [3].x = x + width; points [3].y = y + height - thickness; XFillPolygon (dpy, window, gc2, points, 4, Convex, CoordModeOrigin); points [0].x = x; points [0].y = y + height; points [1].x = x + width; points [1].y = y + height; points [2].x = x + width; points [2].y = y + height - thickness; points [3].x = x + thickness; points [3].y = y + height - thickness; XFillPolygon (dpy, window, gc2, points, 4, Convex, CoordModeOrigin); XFreeGC (dpy, gc1); XFreeGC (dpy, gc2); } x11-ssh-askpass-1.2.4.1/dynlist.c0100644000135600013560000000432107351324572016557 0ustar jmknoblejmknoble/* dynlist.c: Dynamic lists and buffers in C. * created 1999-Jan-06 15:34 jmk * autodate: 2001-Sep-16 18:08 * * by Jim Knoble * Copyright (C) 1999,2000,2001 Jim Knoble * * Disclaimer: * * The software is provided "as is", without warranty of any kind, * express or implied, including but not limited to the warranties of * merchantability, fitness for a particular purpose and * noninfringement. In no event shall the author(s) be liable for any * claim, damages or other liability, whether in an action of * contract, tort or otherwise, arising from, out of or in connection * with the software or the use or other dealings in the software. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation. */ #include #include #include "dynlist.h" #define LIST_CHUNK_SIZE 512 #define BUF_CHUNK_SIZE 512 /* For lists of pointers cast to char *. */ int append_to_list(char ***list_ptr, int *list_len, int *i, char *item) { char **tmp_ptr; if (*i >= *list_len) { *list_len += LIST_CHUNK_SIZE; if (NULL == *list_ptr) { tmp_ptr = malloc(sizeof(**list_ptr) * *list_len); } else { tmp_ptr = realloc(*list_ptr, (sizeof(**list_ptr) * *list_len)); } if (NULL == tmp_ptr) { return(APPEND_FAILURE); } *list_ptr = tmp_ptr; } (*list_ptr)[*i] = item; (*i)++; return(APPEND_SUCCESS); } /* For single-dimensional buffers. */ int append_to_buf(char **buf, int *buflen, int *i, int c) { char *tmp_buf; if (*i >= *buflen) { *buflen += BUF_CHUNK_SIZE; if (NULL == *buf) { tmp_buf = malloc(sizeof(**buf) * *buflen); } else { tmp_buf = realloc(*buf, (sizeof(**buf) * *buflen)); } if (NULL == tmp_buf) { return(APPEND_FAILURE); } *buf = tmp_buf; #ifdef DEBUG printf("-->Allocated buffer of size %d\n", *buflen); #endif /* DEBUG */ } (*buf)[*i] = (char) c; (*i)++; return(APPEND_SUCCESS); } x11-ssh-askpass-1.2.4.1/resources.c0100644000135600013560000001072007351324572017103 0ustar jmknoblejmknoble/* xscreensaver, Copyright (c) 1992, 1997, 1998 * Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. No representations are made about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. */ /* 1999-Nov-21 Modified by Jim Knoble . * Modifications: * * - Made get_boolean_resource() accept a third parameter, default_value, * which determines the result of get_boolean_resource if either (a) * no such resource exists, or (b) the resource value does not conform * to the syntax of a boolean resource. * * - Same for get_integer_resource(), get_pixel_resource(). * * - 1999-Dec-24 Moved header includes from utils.h to here. * Trimmed unused functions. */ #include #include #include #include #include #include #include #include "resources.h" /* Resource functions. Assumes: */ extern char *progname; extern char *progclass; extern XrmDatabase db; #ifndef isupper # define isupper(c) ((c) >= 'A' && (c) <= 'Z') #endif #ifndef _tolower # define _tolower(c) ((c) - 'A' + 'a') #endif char * get_string_resource (char *res_name, char *res_class) { XrmValue value; char *type; char full_name [1024], full_class [1024]; strcpy (full_name, progname); strcat (full_name, "."); strcat (full_name, res_name); strcpy (full_class, progclass); strcat (full_class, "."); strcat (full_class, res_class); if (XrmGetResource (db, full_name, full_class, &type, &value)) { char *str = (char *) malloc (value.size + 1); strncpy (str, (char *) value.addr, value.size); str [value.size] = 0; return str; } return 0; } Bool get_boolean_resource (char *res_name, char *res_class, Bool default_value) { char *tmp, buf [100]; char *s = get_string_resource (res_name, res_class); char *os = s; if (! s) return default_value; for (tmp = buf; *s; s++) *tmp++ = isupper (*s) ? _tolower (*s) : *s; *tmp = 0; free (os); while (*buf && (buf[strlen(buf)-1] == ' ' || buf[strlen(buf)-1] == '\t')) buf[strlen(buf)-1] = 0; if (!strcmp (buf, "on") || !strcmp (buf, "true") || !strcmp (buf, "yes")) return 1; if (!strcmp (buf,"off") || !strcmp (buf, "false") || !strcmp (buf,"no")) return 0; fprintf (stderr, "%s: %s must be boolean, not %s.\n", progname, res_name, buf); return default_value; } int get_integer_resource (char *res_name, char *res_class, int default_value) { int val; char c, *s = get_string_resource (res_name, res_class); char *ss = s; if (!s) return default_value; while (*ss && *ss <= ' ') ss++; /* skip whitespace */ if (ss[0] == '0' && (ss[1] == 'x' || ss[1] == 'X')) /* 0x: parse as hex */ { if (1 == sscanf (ss+2, "%x %c", &val, &c)) { free (s); return val; } } else /* else parse as dec */ { if (1 == sscanf (ss, "%d %c", &val, &c)) { free (s); return val; } } fprintf (stderr, "%s: %s must be an integer, not %s.\n", progname, res_name, s); free (s); return default_value; } double get_float_resource (char *res_name, char *res_class) { double val; char c, *s = get_string_resource (res_name, res_class); if (! s) return 0.0; if (1 == sscanf (s, " %lf %c", &val, &c)) { free (s); return val; } fprintf (stderr, "%s: %s must be a float, not %s.\n", progname, res_name, s); free (s); return 0.0; } unsigned int get_pixel_resource (char *res_name, char *res_class, Display *dpy, Colormap cmap, unsigned int default_value) { XColor color; char *s = get_string_resource (res_name, res_class); char *s2; if (!s) goto DEFAULT; for (s2 = s + strlen(s) - 1; s2 > s; s2--) if (*s2 == ' ' || *s2 == '\t') *s2 = 0; else break; if (! XParseColor (dpy, cmap, s, &color)) { fprintf (stderr, "%s: can't parse color %s\n", progname, s); goto DEFAULT; } if (! XAllocColor (dpy, cmap, &color)) { fprintf (stderr, "%s: couldn't allocate color %s\n", progname, s); goto DEFAULT; } free (s); return color.pixel; DEFAULT: if (s) free (s); return default_value; } x11-ssh-askpass-1.2.4.1/x11-ssh-askpass.c0100644000135600013560000013356207351324572017752 0ustar jmknoblejmknoble/* x11-ssh-askpass.c: A generic X11-based password dialog for OpenSSH. * created 1999-Nov-17 03:40 Jim Knoble * autodate: 2001-Sep-16 18:08 * * by Jim Knoble * Copyright (C) 1999,2000,2001 Jim Knoble * * Disclaimer: * * The software is provided "as is", without warranty of any kind, * express or implied, including but not limited to the warranties of * merchantability, fitness for a particular purpose and * noninfringement. In no event shall the author(s) be liable for any * claim, damages or other liability, whether in an action of * contract, tort or otherwise, arising from, out of or in connection * with the software or the use or other dealings in the software. * * Portions of this code are distantly derived from code in xscreensaver * by Jamie Zawinski . That code says: * * --------8<------------------------------------------------8<-------- * xscreensaver, Copyright (c) 1991-1999 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. No representations are made about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * --------8<------------------------------------------------8<-------- * * The remainder of this code falls under the same permissions and * provisions as those of the xscreensaver code. */ #include #include #include #include /* For (get|set)rlimit() ... */ #include #include /* ... end */ /* For (get|set)rlimit(), sleep(), and getpid() ... */ #include /* ... end */ /* For errno ... */ #include /* ... end */ #include #include #include #include #include "dynlist.h" #include "drawing.h" #include "resources.h" #include "x11-ssh-askpass.h" #undef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) char *progname = NULL; char *progclass = NULL; XrmDatabase db = 0; static char *defaults[] = { #include "SshAskpass_ad.h" 0 }; void outOfMemory(AppInfo *app, int line) { fprintf(stderr, "%s[%ld]: Aaahhh! I ran out of memory at line %d.\n", app->appName, (long) app->pid, line); exit(EXIT_STATUS_NO_MEMORY); } void freeIf(void *p) { if (p) { free(p); } } void freeFontIf(AppInfo *app, XFontStruct *f) { if (f) { XFreeFont(app->dpy, f); } } XFontStruct *getFontResource(AppInfo *app, char *instanceName, char *className) { char *fallbackFont = "fixed"; XFontStruct *f = NULL; char *s = get_string_resource(instanceName, className); f = XLoadQueryFont(app->dpy, (s ? s : fallbackFont)); if (!f) { f = XLoadQueryFont(app->dpy, fallbackFont); } if (s) { free(s); } return(f); } char *getStringResourceWithDefault(char *instanceName, char *className, char *defaultText) { char *s = get_string_resource(instanceName, className); if (!s) { if (!defaultText) { s = strdup(""); } else { s = strdup(defaultText); } } return(s); } unsigned int getUnsignedIntegerResource(AppInfo *app, char *instanceName, char *className, unsigned int defaultValue) { int n; unsigned int value; char c; char *s = get_string_resource(instanceName, className); char *cp = s; if (NULL == s) { return(defaultValue); } while ((*cp) && isspace(*cp)) { /* Skip whitespace. */ cp++; } if (*cp) { if (('0' == cp[0]) && cp[1]) { if (('x' == cp[1]) || ('X' == cp[1])) { /* Hex */ n = sscanf(cp + 2, "%x %c", &value, &c); } else { /* Octal */ n = sscanf(cp + 1, "%o %c", &value, &c); } if (1 == n) { free(s); return(value); } } else { /* Unsigned Decimal */ n = sscanf(cp, "%u %c", &value, &c); if (1 == n) { free(s); return(value); } } } /* If we get here, no conversion succeeded. */ fprintf(stderr, "%s[%ld]: invalid value '%s' for %s.\n", app->appName, (long) app->pid, s, instanceName); free(s); return(defaultValue); } /* Default resolution is 75 dots/inch. 1 in = 2.54 cm. */ #define DefaultResolution ((75 * 10000) / 254) long getResolutionResource(AppInfo *app, char *instanceName, char *className, char *defaultResolutionSpec) { char units[3]; char *s; int n; long resolution; unsigned int i; memset(units, 0, sizeof(units)); s = getStringResourceWithDefault(instanceName, className, defaultResolutionSpec); /* NOTE: The width of the %s format must be one less than * the length of the units[] array above! */ n = sscanf(s, "%ld / %2s", &resolution, units); if (n != 2) { fprintf(stderr, "%s[%ld]: invalid value '%s' for %s.\n", app->appName, (long) app->pid, s, instanceName); resolution = DefaultResolution; } else { if (resolution < 0) { /* Resolution specifications should not be negative. */ resolution = -(resolution); } for (i = 0; i < (sizeof(units) - 1); i++) { units[i] = tolower(units[i]); } if ((0 == strcmp(units, "in")) || (0 == strcmp(units, "i")) || (0 == strcmp(units, "\""))) { /* dots/inch */ resolution = resolution * 10000 / 254; } else if ((0 == strcmp(units, "m")) || (0 == strcmp(units, "me"))) { /* dots/meter; no conversion necessary */ ; } else { /* some unit we don't recognize; cringe and stare at the floor */ resolution = DefaultResolution; } } return(resolution); } #undef DefaultResolution void calcTextObjectExtents(TextObject *t, XFontStruct *font) { if ((!t) || (!(t->text))) { return; } t->textLength = strlen(t->text); XTextExtents(font, t->text, t->textLength, &(t->direction), &(t->ascent), &(t->descent), &(t->overall)); } void calcLabelTextExtents(LabelInfo *label) { TextObject *t; if ((!label) || (!(label->fullText)) || (!(label->font))) { return; } t = label->multiText; while (NULL != t) { calcTextObjectExtents(t, label->font); label->w.height += (t->ascent + t->descent); if (label->w.width < t->overall.width) { label->w.width = t->overall.width; } t = t->next; } } void calcTotalButtonExtents(ButtonInfo *button) { if (!button) { return; } button->w3.w.width = (button->w3.interiorWidth + (2 * button->w3.shadowThickness)); button->w3.w.width += (2 * button->w3.borderWidth); button->w3.w.height = (button->w3.interiorHeight + (2 * button->w3.shadowThickness)); button->w3.w.height += (2 * button->w3.borderWidth); } void calcButtonExtents(ButtonInfo *button) { if (!button) { return; } calcLabelTextExtents(&(button->label)); button->w3.interiorWidth = (button->label.w.width + (2 * button->w3.horizontalSpacing)); button->w3.interiorHeight = (button->label.w.height + (2 * button->w3.verticalSpacing)); calcTotalButtonExtents(button); } void balanceButtonExtents(ButtonInfo *button1, ButtonInfo *button2) { if ((!button1) || (!button2)) { return; } button1->w3.interiorWidth = button2->w3.interiorWidth = MAX(button1->w3.interiorWidth, button2->w3.interiorWidth); button1->w3.interiorHeight = button2->w3.interiorHeight = MAX(button1->w3.interiorHeight, button2->w3.interiorHeight); calcTotalButtonExtents(button1); calcTotalButtonExtents(button2); } void calcButtonLabelPosition(ButtonInfo *button) { if (!button) { return; } button->label.w.x = button->w3.w.x + ((button->w3.w.width - button->label.w.width) / 2); button->label.w.y = button->w3.w.y + ((button->w3.w.height - button->label.w.height) / 2); } Dimension scaleXDimension(AppInfo *app, Dimension unscaled) { Dimension scaled; if (((app->defaultXResolution < app->xResolution) && ((app->defaultXResolution + app->xFuzz) < app->xResolution)) || ((app->xResolution < app->defaultXResolution) && ((app->xResolution + app->xFuzz) < app->defaultXResolution))) { scaled = (unscaled * app->xResolution) / app->defaultXResolution; } else { scaled = unscaled; } return(scaled); } Dimension scaleYDimension(AppInfo *app, Dimension unscaled) { Dimension scaled; if (((app->defaultYResolution < app->yResolution) && ((app->defaultYResolution + app->yFuzz) < app->yResolution)) || ((app->yResolution < app->defaultYResolution) && ((app->yResolution + app->yFuzz) < app->defaultYResolution))) { scaled = (unscaled * app->yResolution) / app->defaultYResolution; } else { scaled = unscaled; } return(scaled); } /* Assumes 's' is non-NULL. */ TextObject *createTextObject(AppInfo *app, char *s) { TextObject *t = malloc(sizeof(*t)); if (NULL == t) { outOfMemory(app, __LINE__); } memset(t, 0, sizeof(*t)); if (('\n' == *s) || ('\0' == *s)) { t->text = " "; } else { t->text = s; } return(t); } /* Assumes 'label' object exists and is zeroed. */ void createLabel(AppInfo *app, char *text, LabelInfo *label) { char *substring; TextObject *t; if ((!app) || (!text)) { return; } label->fullText = strdup(text); label->multiText = createTextObject(app, label->fullText); t = label->multiText; substring = strchr(label->fullText, '\n'); while (NULL != substring) { *(substring++) = '\0'; t->next = createTextObject(app, substring); if (t->next) { t = t->next; } substring = strchr(substring, '\n'); } } void createDialog(AppInfo *app) { DialogInfo *d; char *labelText; if (app->dialog) { return; } d = malloc(sizeof(*d)); if (NULL == d) { outOfMemory(app, __LINE__); } memset(d, 0, sizeof(*d)); app->grabKeyboard = get_boolean_resource("grabKeyboard", "GrabKeyboard", True); app->grabPointer = get_boolean_resource("grabPointer", "GrabPointer", False); app->grabServer = get_boolean_resource("grabServer", "GrabServer", False); /* inputTimeout resource specified in seconds for easy human interface. * Convert to milliseconds here. */ app->inputTimeout = (unsigned long) 1000 * getUnsignedIntegerResource(app, "inputTimeout", "InputTimeout", 0); app->defaultXResolution = getResolutionResource(app, "defaultXResolution", "DefaultXResolution", "75/in"); app->defaultYResolution = getResolutionResource(app, "defaultYResolution", "DefaultYResolution", "75/in"); app->xFuzz = getResolutionResource(app, "xResolutionFuzz", "XResolutionFuzz", "20/in"); app->yFuzz = getResolutionResource(app, "yResolutionFuzz", "YResolutionFuzz", "20/in"); d->title = getStringResourceWithDefault("dialog.title", "Dialog.Title", "OpenSSH Authentication Passphrase Request"); d->w3.w.foreground = get_pixel_resource("foreground", "Foreground", app->dpy, app->colormap, app->black); d->w3.w.background = get_pixel_resource("background", "Background", app->dpy, app->colormap, app->white); d->w3.topShadowColor = get_pixel_resource("topShadowColor", "TopShadowColor", app->dpy, app->colormap, app->white); d->w3.bottomShadowColor = get_pixel_resource("bottomShadowColor", "BottomShadowColor", app->dpy, app->colormap, app->black); d->w3.shadowThickness = get_integer_resource("shadowThickness", "ShadowThickness", 3); d->w3.borderColor = get_pixel_resource("borderColor", "BorderColor", app->dpy, app->colormap, app->black); d->w3.borderWidth = get_integer_resource("borderWidth", "BorderWidth", 1); d->w3.horizontalSpacing = scaleXDimension(app, get_integer_resource("horizontalSpacing", "Spacing", 5)); d->w3.verticalSpacing = scaleYDimension(app, get_integer_resource("verticalSpacing", "Spacing", 6)); if (2 == app->argc) { labelText = strdup(app->argv[1]); } else { labelText = getStringResourceWithDefault("dialog.label", "Dialog.Label", "Please enter your authentication passphrase:"); } createLabel(app, labelText, &(d->label)); freeIf(labelText); d->label.font = getFontResource(app, "dialog.font", "Dialog.Font"); calcLabelTextExtents(&(d->label)); d->label.w.foreground = d->w3.w.foreground; d->label.w.background = d->w3.w.background; d->okButton.w3.w.foreground = get_pixel_resource("okButton.foreground", "Button.Foreground", app->dpy, app->colormap, app->black); d->okButton.w3.w.background = get_pixel_resource("okButton.background", "Button.Background", app->dpy, app->colormap, app->white); d->okButton.w3.topShadowColor = get_pixel_resource("okButton.topShadowColor", "Button.TopShadowColor", app->dpy, app->colormap, app->white); d->okButton.w3.bottomShadowColor = get_pixel_resource("okButton.bottomShadowColor", "Button.BottomShadowColor", app->dpy, app->colormap, app->black); d->okButton.w3.shadowThickness = get_integer_resource("okButton.shadowThickness", "Button.ShadowThickness", 2); d->okButton.w3.borderColor = get_pixel_resource("okButton.borderColor", "Button.BorderColor", app->dpy, app->colormap, app->black); d->okButton.w3.borderWidth = get_integer_resource("okButton.borderWidth", "Button.BorderWidth", 1); d->okButton.w3.horizontalSpacing = scaleXDimension(app, get_integer_resource("okButton.horizontalSpacing", "Button.Spacing", 4)); d->okButton.w3.verticalSpacing = scaleYDimension(app, get_integer_resource("okButton.verticalSpacing", "Button.Spacing", 2)); labelText = getStringResourceWithDefault("okButton.label", "Button.Label", "OK"); createLabel(app, labelText, &(d->okButton.label)); freeIf(labelText); d->okButton.label.font = getFontResource(app, "okButton.font", "Button.Font"); calcButtonExtents(&(d->okButton)); d->okButton.label.w.foreground = d->okButton.w3.w.foreground; d->okButton.label.w.background = d->okButton.w3.w.background; d->cancelButton.w3.w.foreground = get_pixel_resource("cancelButton.foreground", "Button.Foreground", app->dpy, app->colormap, app->black); d->cancelButton.w3.w.background = get_pixel_resource("cancelButton.background", "Button.Background", app->dpy, app->colormap, app->white); d->cancelButton.w3.topShadowColor = get_pixel_resource("cancelButton.topShadowColor", "Button.TopShadowColor", app->dpy, app->colormap, app->white); d->cancelButton.w3.bottomShadowColor = get_pixel_resource("cancelButton.bottomShadowColor", "Button.BottomShadowColor", app->dpy, app->colormap, app->black); d->cancelButton.w3.shadowThickness = get_integer_resource("cancelButton.shadowThickness", "Button.ShadowThickness", 2); d->cancelButton.w3.borderColor = get_pixel_resource("cancelButton.borderColor", "Button.BorderColor", app->dpy, app->colormap, app->black); d->cancelButton.w3.borderWidth = get_integer_resource("cancelButton.borderWidth", "Button.BorderWidth", 1); d->cancelButton.w3.horizontalSpacing = scaleXDimension(app, get_integer_resource("cancelButton.horizontalSpacing", "Button.Spacing", 4)); d->cancelButton.w3.verticalSpacing = scaleYDimension(app, get_integer_resource("cancelButton.verticalSpacing", "Button.Spacing", 2)); labelText = getStringResourceWithDefault("cancelButton.label", "Button.Label", "Cancel"); createLabel(app, labelText, &(d->cancelButton.label)); freeIf(labelText); d->cancelButton.label.font = getFontResource(app, "cancelButton.font", "Button.Font"); calcButtonExtents(&(d->cancelButton)); d->cancelButton.label.w.foreground = d->cancelButton.w3.w.foreground; d->cancelButton.label.w.background = d->cancelButton.w3.w.background; balanceButtonExtents(&(d->okButton), &(d->cancelButton)); d->indicator.w3.w.foreground = get_pixel_resource("indicator.foreground", "Indicator.Foreground", app->dpy, app->colormap, app->black); d->indicator.w3.w.background = get_pixel_resource("indicator.background", "Indicator.Background", app->dpy, app->colormap, app->white); d->indicator.w3.w.width = scaleXDimension(app, get_integer_resource("indicator.width", "Indicator.Width", 15)); d->indicator.w3.w.height = scaleYDimension(app, get_integer_resource("indicator.height", "Indicator.Height", 7)); d->indicator.w3.topShadowColor = get_pixel_resource("indicator.topShadowColor", "Indicator.TopShadowColor", app->dpy, app->colormap, app->white); d->indicator.w3.bottomShadowColor = get_pixel_resource("indicator.bottomShadowColor", "Indicator.BottomShadowColor", app->dpy, app->colormap, app->black); d->indicator.w3.shadowThickness = get_integer_resource("indicator.shadowThickness", "Indicator.ShadowThickness", 2); d->indicator.w3.borderColor = get_pixel_resource("indicator.borderColor", "Indicator.BorderColor", app->dpy, app->colormap, app->black); d->indicator.w3.borderWidth = get_integer_resource("indicator.borderWidth", "Indicator.BorderWidth", 0); d->indicator.w3.horizontalSpacing = scaleXDimension(app, get_integer_resource("indicator.horizontalSpacing", "Indicator.Spacing", 2)); d->indicator.w3.verticalSpacing =scaleYDimension(app, get_integer_resource("indicator.verticalSpacing", "Indicator.Spacing", 4)); d->indicator.minimumCount = get_integer_resource("indicator.minimumCount", "Indicator.MinimumCount", 8); d->indicator.maximumCount = get_integer_resource("indicator.maximumCount", "Indicator.MaximumCount", 24); d->indicator.w3.interiorWidth = d->indicator.w3.w.width; d->indicator.w3.interiorHeight = d->indicator.w3.w.height; d->indicator.w3.w.width += (2 * d->indicator.w3.shadowThickness); d->indicator.w3.w.width += (2 * d->indicator.w3.borderWidth); d->indicator.w3.w.height += (2 * d->indicator.w3.shadowThickness); d->indicator.w3.w.height += (2 * d->indicator.w3.borderWidth); { /* Make sure the indicators can all fit on the screen. * 80% of the screen width seems fine. */ Dimension maxWidth = (WidthOfScreen(app->screen) * 8 / 10); Dimension extraSpace = ((2 * d->w3.horizontalSpacing) + (2 * d->w3.shadowThickness)); if (d->indicator.maximumCount < 8) { d->indicator.maximumCount = 8; } if (((d->indicator.maximumCount * d->indicator.w3.w.width) + ((d->indicator.maximumCount - 1) * d->indicator.w3.horizontalSpacing) + extraSpace) > maxWidth) { d->indicator.maximumCount = ((maxWidth - extraSpace - d->indicator.w3.w.width) / (d->indicator.w3.w.width + d->indicator.w3.horizontalSpacing)) + 1; } if (d->indicator.minimumCount <= 6) { d->indicator.minimumCount = 6; } if (d->indicator.minimumCount > d->indicator.maximumCount) { d->indicator.minimumCount = d->indicator.maximumCount; } } { /* Calculate the width and horizontal position of things. */ Dimension labelAreaWidth; Dimension buttonAreaWidth; Dimension indicatorAreaWidth; Dimension extraIndicatorSpace; Dimension singleIndicatorSpace; Dimension interButtonSpace; Dimension w; Position leftX; int i; labelAreaWidth = d->label.w.width + (2 * d->w3.horizontalSpacing); buttonAreaWidth = ((3 * d->w3.horizontalSpacing) + d->okButton.w3.w.width + d->cancelButton.w3.w.width); w = MAX(labelAreaWidth, buttonAreaWidth); extraIndicatorSpace = ((2 * d->w3.horizontalSpacing) + d->indicator.w3.w.width); singleIndicatorSpace = (d->indicator.w3.w.width + d->indicator.w3.horizontalSpacing); d->indicator.count = ((w - extraIndicatorSpace) / singleIndicatorSpace); d->indicator.current = 0; d->indicator.count++; /* For gatepost indicator in extra space. */ if (((w - extraIndicatorSpace) % singleIndicatorSpace) > (singleIndicatorSpace / 2)) { d->indicator.count++; } if (d->indicator.count < d->indicator.minimumCount) { d->indicator.count = d->indicator.minimumCount; } if (d->indicator.count > d->indicator.maximumCount) { d->indicator.count = d->indicator.maximumCount; } indicatorAreaWidth = ((singleIndicatorSpace * (d->indicator.count - 1)) + extraIndicatorSpace); d->w3.interiorWidth = MAX(w, indicatorAreaWidth); d->w3.w.width = d->w3.interiorWidth + (2 * d->w3.shadowThickness); leftX = (d->w3.w.width - d->label.w.width) / 2; d->label.w.x = leftX; leftX = ((d->w3.w.width - (d->indicator.count * d->indicator.w3.w.width) - ((d->indicator.count - 1) * d->indicator.w3.horizontalSpacing)) / 2); { int n = d->indicator.count * sizeof(IndicatorElement); d->indicators = malloc(n); if (NULL == d->indicators) { destroyDialog(app); outOfMemory(app, __LINE__); } memset(d->indicators, 0, n); } d->indicators[0].parent = &(d->indicator); d->indicators[0].w.x = d->indicator.w3.w.x = leftX; d->indicators[0].w.width = d->indicator.w3.w.width; d->indicators[0].isLit = False; for (i = 1; i < d->indicator.count; i++) { d->indicators[i].parent = &(d->indicator); d->indicators[i].w.x = (d->indicators[i - 1].w.x + d->indicator.w3.w.width + d->indicator.w3.horizontalSpacing); d->indicators[i].w.width = d->indicator.w3.w.width; d->indicators[i].isLit = False; } interButtonSpace = ((d->w3.interiorWidth - d->okButton.w3.w.width - d->cancelButton.w3.w.width) / 3); d->okButton.w3.w.x = interButtonSpace + d->w3.shadowThickness; d->cancelButton.w3.w.x = (d->okButton.w3.w.x + d->okButton.w3.w.width + interButtonSpace); } { /* Calculate the height and vertical position of things. */ int i; d->w3.interiorHeight = ((4 * d->w3.verticalSpacing) + (2 * d->indicator.w3.verticalSpacing) + d->label.w.height + d->indicator.w3.w.height + d->okButton.w3.w.height); d->w3.w.height = d->w3.interiorHeight + (2 * d->w3.shadowThickness); d->label.w.y = d->w3.shadowThickness + d->w3.verticalSpacing; d->indicator.w3.w.y = (d->label.w.y + d->label.w.height + d->w3.verticalSpacing + d->indicator.w3.verticalSpacing); for (i = 0; i < d->indicator.count; i++) { d->indicators[i].w.y = d->indicator.w3.w.y; d->indicators[i].w.height = d->indicator.w3.w.height; } d->okButton.w3.w.y = d->cancelButton.w3.w.y = (d->indicator.w3.w.y + d->indicator.w3.w.height + d->w3.verticalSpacing + d->indicator.w3.verticalSpacing); } calcButtonLabelPosition(&(d->okButton)); calcButtonLabelPosition(&(d->cancelButton)); d->w3.w.x = (WidthOfScreen(app->screen) - d->w3.w.width) / 2; d->w3.w.y = (HeightOfScreen(app->screen) - d->w3.w.height) / 3; app->dialog = d; } void destroyLabel(AppInfo *app, LabelInfo *label) { TextObject *thisTextObject; TextObject *nextTextObject; thisTextObject = label->multiText; nextTextObject = thisTextObject->next; freeIf(thisTextObject); while (NULL != nextTextObject) { thisTextObject = nextTextObject; nextTextObject = thisTextObject->next; freeIf(thisTextObject); } freeIf(label->fullText); freeFontIf(app, label->font); } void destroyDialog(AppInfo *app) { DialogInfo *d = app->dialog; freeIf(d->title); freeIf(d->indicators); destroyLabel(app, &(d->label)); destroyLabel(app, &(d->okButton.label)); destroyLabel(app, &(d->cancelButton.label)); XFree(d->sizeHints); XFree(d->wmHints); XFree(d->classHints); XFree(d->windowName.value); freeIf(d); } void createDialogWindow(AppInfo *app) { XSetWindowAttributes attr; unsigned long attrMask = 0; DialogInfo *d = app->dialog; attr.background_pixel = d->w3.w.background; attrMask |= CWBackPixel; attr.border_pixel = d->w3.borderColor; attrMask |= CWBorderPixel; attr.cursor = None; attrMask |= CWCursor; attr.event_mask = app->eventMask; attrMask |= CWEventMask; d->dialogWindow = XCreateWindow(app->dpy, app->rootWindow, d->w3.w.x, d->w3.w.y, d->w3.w.width, d->w3.w.height, d->w3.borderWidth, DefaultDepthOfScreen(app->screen), InputOutput, DefaultVisualOfScreen(app->screen), attrMask, &attr); d->sizeHints = XAllocSizeHints(); if (!(d->sizeHints)) { destroyDialog(app); outOfMemory(app, __LINE__); } d->sizeHints->flags = 0; d->sizeHints->flags |= PPosition; d->sizeHints->flags |= PSize; d->sizeHints->min_width = d->w3.w.width; d->sizeHints->min_height = d->w3.w.height; d->sizeHints->flags |= PMinSize; d->sizeHints->max_width = d->w3.w.width; d->sizeHints->max_height = d->w3.w.height; d->sizeHints->flags |= PMaxSize; d->sizeHints->base_width = d->w3.w.width; d->sizeHints->base_height = d->w3.w.height; d->sizeHints->flags |= PBaseSize; d->wmHints = XAllocWMHints(); if (!(d->wmHints)) { destroyDialog(app); outOfMemory(app, __LINE__); } d->wmHints->flags = 0; d->wmHints->input = True; d->wmHints->flags |= InputHint; d->wmHints->initial_state = NormalState; d->wmHints->flags |= StateHint; d->classHints = XAllocClassHint(); if (!(d->classHints)) { destroyDialog(app); outOfMemory(app, __LINE__); } d->classHints->res_name = app->appName; d->classHints->res_class = app->appClass; if (!XStringListToTextProperty(&(d->title), 1, &(d->windowName))) { destroyDialog(app); outOfMemory(app, __LINE__); } XSetWMProperties(app->dpy, d->dialogWindow, &(d->windowName), NULL, app->argv, app->argc, d->sizeHints, d->wmHints, d->classHints); XSetTransientForHint(app->dpy, d->dialogWindow, d->dialogWindow); app->wmDeleteWindowAtom = XInternAtom(app->dpy, "WM_DELETE_WINDOW", False); XSetWMProtocols(app->dpy, d->dialogWindow, &(app->wmDeleteWindowAtom), 1); } void createGCs(AppInfo *app) { DialogInfo *d = app->dialog; XGCValues gcv; unsigned long gcvMask; gcvMask = 0; gcv.foreground = d->w3.w.background; gcvMask |= GCForeground; gcv.fill_style = FillSolid; gcvMask |= GCFillStyle; app->fillGC = XCreateGC(app->dpy, app->rootWindow, gcvMask, &gcv); gcvMask = 0; gcv.foreground = d->w3.borderColor; gcvMask |= GCForeground; gcv.line_width = d->w3.borderWidth; gcvMask |= GCLineWidth; gcv.line_style = LineSolid; gcvMask |= GCLineStyle; gcv.cap_style = CapButt; gcvMask |= GCCapStyle; gcv.join_style = JoinMiter; gcvMask |= GCJoinStyle; app->borderGC = XCreateGC(app->dpy, app->rootWindow, gcvMask, &gcv); gcvMask = 0; gcv.foreground = d->label.w.foreground; gcvMask |= GCForeground; gcv.background = d->label.w.background; gcvMask |= GCBackground; gcv.font = d->label.font->fid; gcvMask |= GCFont; app->textGC = XCreateGC(app->dpy, app->rootWindow, gcvMask, &gcv); gcvMask = 0; gcv.foreground = d->indicator.w3.w.foreground; gcvMask |= GCForeground; gcv.fill_style = FillSolid; gcvMask |= GCFillStyle; app->brightGC = XCreateGC(app->dpy, app->rootWindow, gcvMask, &gcv); gcvMask = 0; gcv.foreground = d->indicator.w3.w.background; gcvMask |= GCForeground; gcv.fill_style = FillSolid; gcvMask |= GCFillStyle; app->dimGC = XCreateGC(app->dpy, app->rootWindow, gcvMask, &gcv); } void destroyGCs(AppInfo *app) { XFreeGC(app->dpy, app->fillGC); XFreeGC(app->dpy, app->borderGC); XFreeGC(app->dpy, app->textGC); XFreeGC(app->dpy, app->brightGC); XFreeGC(app->dpy, app->dimGC); } void paintLabel(AppInfo *app, Drawable draw, LabelInfo label) { TextObject *t; Position x; Position y; if (!(label.fullText)) { return; } XSetForeground(app->dpy, app->textGC, label.w.foreground); XSetBackground(app->dpy, app->textGC, label.w.background); XSetFont(app->dpy, app->textGC, label.font->fid); t = label.multiText; x = label.w.x; y = label.w.y + t->ascent; while (NULL != t) { if (t->text) { XDrawString(app->dpy, draw, app->textGC, x, y, t->text, t->textLength); } y += t->descent; t = t->next; if (t) { y += t->ascent; } } } void paintButton(AppInfo *app, Drawable draw, ButtonInfo button) { Position x; Position y; Dimension width; Dimension height; if (button.w3.borderWidth > 0) { XSetForeground(app->dpy, app->borderGC, button.w3.borderColor); XFillRectangle(app->dpy, draw, app->borderGC, button.w3.w.x, button.w3.w.y, button.w3.w.width, button.w3.w.height); } if ((button.w3.shadowThickness <= 0) && (button.pressed)) { Pixel tmp = button.w3.w.background; button.w3.w.background = button.w3.w.foreground; button.w3.w.foreground = tmp; tmp = button.label.w.background; button.label.w.background = button.label.w.foreground; button.label.w.foreground = tmp; } x = (button.w3.w.x + button.w3.borderWidth); y = (button.w3.w.y + button.w3.borderWidth); width = (button.w3.w.width - (2 * button.w3.borderWidth)); height = (button.w3.w.height - (2 * button.w3.borderWidth)); if ((button.w3.shadowThickness > 0) && (button.pressed)) { XSetForeground(app->dpy, app->fillGC, button.w3.topShadowColor); } else { XSetForeground(app->dpy, app->fillGC, button.w3.w.background); } XFillRectangle(app->dpy, draw, app->fillGC, x, y, width, height); if (button.w3.shadowThickness > 0) { if (button.pressed) { draw_shaded_rectangle(app->dpy, draw, x, y, width, height, button.w3.shadowThickness, button.w3.bottomShadowColor, button.w3.topShadowColor); } else { draw_shaded_rectangle(app->dpy, draw, x, y, width, height, button.w3.shadowThickness, button.w3.topShadowColor, button.w3.bottomShadowColor); } } if ((button.w3.shadowThickness > 0) && (button.pressed)) { Dimension pressedAdjustment; pressedAdjustment = button.w3.shadowThickness / 2; if (pressedAdjustment < 1) { pressedAdjustment = 1; } x = button.label.w.x; y = button.label.w.y; button.label.w.x += pressedAdjustment; button.label.w.y += pressedAdjustment; paintLabel(app, draw, button.label); button.label.w.x = x; button.label.w.y = y; } else { paintLabel(app, draw, button.label); } if ((button.w3.shadowThickness <= 0) && (button.pressed)) { Pixel tmp = button.w3.w.background; button.w3.w.background = button.w3.w.foreground; button.w3.w.foreground = tmp; tmp = button.label.w.background; button.label.w.background = button.label.w.foreground; button.label.w.foreground = tmp; } } void paintIndicator(AppInfo *app, Drawable draw, IndicatorElement indicator) { Position x; Position y; Dimension width; Dimension height; GC gc = app->dimGC; if (indicator.parent->w3.borderWidth > 0) { XSetForeground(app->dpy, app->borderGC, indicator.parent->w3.borderColor); XFillRectangle(app->dpy, draw, app->borderGC, indicator.w.x, indicator.w.y, indicator.w.width, indicator.w.height); } if (indicator.isLit) { gc = app->brightGC; } x = (indicator.w.x + indicator.parent->w3.borderWidth); y = (indicator.w.y + indicator.parent->w3.borderWidth); width = (indicator.w.width - (2 * indicator.parent->w3.borderWidth)); height = (indicator.w.height - (2 * indicator.parent->w3.borderWidth)); XFillRectangle(app->dpy, draw, gc, x, y, width, height); if (indicator.parent->w3.shadowThickness > 0) { draw_shaded_rectangle(app->dpy, draw, x, y, width, height, indicator.parent->w3.shadowThickness, indicator.parent->w3.bottomShadowColor, indicator.parent->w3.topShadowColor); } } void updateIndicatorElement(AppInfo *app, int i) { DialogInfo *d = app->dialog; d->indicators[i].isLit = !(d->indicators[i].isLit); paintIndicator(app, d->dialogWindow, d->indicators[i]); } void updateIndicators(AppInfo *app, int condition) { DialogInfo *d = app->dialog; if (condition > 0) { /* Move forward one. */ updateIndicatorElement(app, d->indicator.current); if (d->indicator.current < (d->indicator.count - 1)) { (d->indicator.current)++; } else { d->indicator.current = 0; } } else if (condition < 0) { /* Move backward one. */ if (d->indicator.current > 0) { (d->indicator.current)--; } else { d->indicator.current = d->indicator.count - 1; } updateIndicatorElement(app, d->indicator.current); } else { /* Erase them all. */ int i; for (i = 0; i < d->indicator.count; i++) { d->indicators[i].isLit = False; paintIndicator(app, d->dialogWindow, d->indicators[i]); } d->indicator.current = 0; } XSync(app->dpy, False); } void paintDialog(AppInfo *app) { DialogInfo *d = app->dialog; Drawable draw = d->dialogWindow; int i; XSetForeground(app->dpy, app->fillGC, d->w3.w.background); XFillRectangle(app->dpy, draw, app->fillGC, 0, 0, d->w3.w.width, d->w3.w.height); if (d->w3.shadowThickness > 0) { draw_shaded_rectangle(app->dpy, draw, 0, 0, d->w3.w.width, d->w3.w.height, d->w3.shadowThickness, d->w3.topShadowColor, d->w3.bottomShadowColor); } paintLabel(app, draw, d->label); for (i = 0; i < d->indicator.count; i++) { paintIndicator(app, draw, d->indicators[i]); } paintButton(app, draw, d->okButton); paintButton(app, draw, d->cancelButton); XSync(app->dpy, False); } void performGrab(AppInfo *app, int grabType, char *grabTypeName, Bool shouldGrab, Bool *isGrabbed) { if ((!(shouldGrab)) || (*isGrabbed)) { return; } else if ((GRAB_KEYBOARD != grabType) && (GRAB_POINTER != grabType)) { fprintf(stderr, "%s[%ld]: performGrab: invalid grab type (%d).\n", app->appName, (long) app->pid, grabType); return; } else { int status = GrabInvalidTime; /* keep gcc -Wall from complaining */ unsigned int seconds = 0; int helpful_message = 0; /* keyboard and pointer */ Window grabWindow = app->dialog->dialogWindow; Bool ownerEvents = False; Bool pointerMode = GrabModeAsync; Bool keyboardMode = GrabModeAsync; /* pointer only */ unsigned int eventMask = ButtonPressMask | ButtonReleaseMask; Window confineTo = None; Cursor cursor = None; *isGrabbed = True; if (NULL == grabTypeName) { fprintf(stderr, "%s[%ld]: performGrab: null grab type name.\n", app->appName, (long) app->pid); } if (0 == app->grabFailTimeout) { /* Ensure we try to perform the grab at least once. */ app->grabFailTimeout = 1; } while (seconds < app->grabFailTimeout) { XSync(app->dpy, False); switch (grabType) { case GRAB_KEYBOARD: status = XGrabKeyboard(app->dpy, grabWindow, ownerEvents, pointerMode, keyboardMode, CurrentTime); break; case GRAB_POINTER: status = XGrabPointer(app->dpy, grabWindow, ownerEvents, eventMask, pointerMode, keyboardMode, confineTo, cursor, CurrentTime); break; } XSync(app->dpy, False); if (GrabSuccess == status) { if (helpful_message) { fprintf(stderr, "%s[%ld]: Got %s.\n", app->appName, (long) app->pid, grabTypeName); } break; } if (!helpful_message) { fprintf(stderr, "%s[%ld]: Trying to grab %s ...\n", app->appName, (long) app->pid, grabTypeName); helpful_message = 1; } seconds += app->grabRetryInterval; sleep(app->grabRetryInterval); } if (GrabSuccess != status) { char *reason = "reason unknown"; switch (status) { case AlreadyGrabbed: reason = "someone else already has it"; break; case GrabFrozen: reason = "someone else has frozen it"; break; case GrabInvalidTime: reason = "bad grab time [this shouldn't happen]"; break; case GrabNotViewable: reason = "grab not viewable [this shouldn't happen]"; break; } fprintf(stderr, "%s[%ld]: Could not grab %s (%s)\n", app->appName, (long) app->pid, grabTypeName, reason); exitApp(app, EXIT_STATUS_ERROR); } } } void grabKeyboard(AppInfo *app) { performGrab(app, GRAB_KEYBOARD, "keyboard", app->grabKeyboard, &(app->isKeyboardGrabbed)); } void ungrabKeyboard(AppInfo *app) { if (app->grabKeyboard) { XUngrabKeyboard(app->dpy, CurrentTime); } } void grabPointer(AppInfo *app) { performGrab(app, GRAB_POINTER, "pointer", app->grabPointer, &(app->isPointerGrabbed)); } void ungrabPointer(AppInfo *app) { if (app->grabPointer) { XUngrabPointer(app->dpy, CurrentTime); } } void grabServer(AppInfo *app) { if ((!(app->grabServer)) || (app->isServerGrabbed)) { return; } else { app->isServerGrabbed = True; XSync(app->dpy, False); XGrabServer(app->dpy); XSync(app->dpy, False); } } void ungrabServer(AppInfo *app) { if (app->grabServer) { XUngrabServer(app->dpy); } } void cleanUp(AppInfo *app) { cancelInputTimeout(app); XDestroyWindow(app->dpy, app->dialog->dialogWindow); destroyGCs(app); destroyDialog(app); if (app->buf) { memset(app->buf, 0, app->bufSize); } freeIf(app->buf); ungrabPointer(app); ungrabKeyboard(app); ungrabServer(app); } void exitApp(AppInfo *app, int exitCode) { cleanUp(app); exit(exitCode); } void acceptAction(AppInfo *app) { int status = append_to_buf(&(app->buf), &(app->bufSize), &(app->bufIndex), '\0'); if (APPEND_FAILURE == status) { cleanUp(app); outOfMemory(app, __LINE__); } fputs(app->buf, stdout); fputc('\n', stdout); exitApp(app, EXIT_STATUS_ACCEPT); } void cancelAction(AppInfo *app) { exitApp(app, EXIT_STATUS_CANCEL); } void backspacePassphrase(AppInfo *app) { if (0 >= app->bufIndex) { XBell(app->dpy, 0); return; } (app->bufIndex)--; updateIndicators(app, -1); } void erasePassphrase(AppInfo *app) { if (0 >= app->bufIndex) { XBell(app->dpy, 0); return; } updateIndicators(app, 0); app->bufIndex = 0; } void addToPassphrase(AppInfo *app, char c) { int status = append_to_buf(&(app->buf), &(app->bufSize), &(app->bufIndex), c); if (APPEND_FAILURE == status) { cleanUp(app); outOfMemory(app, __LINE__); } updateIndicators(app, 1); } void handleKeyPress(AppInfo *app, XEvent *event) { char s[2]; int n; if (event->xkey.send_event) { /* Pay no attention to synthetic key events. */ return; } cancelInputTimeout(app); n = XLookupString(&(event->xkey), s, 1, NULL, NULL); if (1 != n) { return; } s[1] = '\0'; switch (s[0]) { case '\010': case '\177': backspacePassphrase(app); break; case '\025': case '\030': erasePassphrase(app); break; case '\012': case '\015': acceptAction(app); break; case '\033': cancelAction(app); break; default: addToPassphrase(app, s[0]); break; } } Bool eventIsInsideButton(AppInfo *app, XEvent *event, ButtonInfo button) { /* 'gcc -Wall' complains about 'app' being an unused parameter. * Tough. We might want to use it later, and then we don't have * to change it in each place it's called. Performance won't suffer. */ int status = False; int x, y; switch(event->type) { case ButtonPress: case ButtonRelease: x = event->xbutton.x; y = event->xbutton.y; break; case MotionNotify: x = event->xmotion.x; y = event->xmotion.y; break; default: return(False); } if ((x >= (button.w3.w.x + button.w3.borderWidth)) && (x < (button.w3.w.x + button.w3.w.width - (2 * button.w3.borderWidth))) && (y >= (button.w3.w.y + button.w3.borderWidth)) && (y < (button.w3.w.y + button.w3.w.height - (2 * button.w3.borderWidth)))) { status = True; } return(status); } void handleButtonPress(AppInfo *app, XEvent *event) { DialogInfo *d = app->dialog; cancelInputTimeout(app); if (event->xbutton.button != Button1) { return; } if (ButtonPress == event->type) { if (eventIsInsideButton(app, event, d->okButton)) { d->pressedButton = OK_BUTTON; d->okButton.pressed = True; paintButton(app, d->dialogWindow, d->okButton); } else if (eventIsInsideButton(app, event, d->cancelButton)) { d->pressedButton = CANCEL_BUTTON; d->cancelButton.pressed = True; paintButton(app, d->dialogWindow, d->cancelButton); } else { d->pressedButton = NO_BUTTON; } } else if (ButtonRelease == event->type) { if (OK_BUTTON == d->pressedButton) { if (eventIsInsideButton(app, event, d->okButton)) { acceptAction(app); } else { if (d->okButton.pressed) { d->okButton.pressed = False; paintButton(app, d->dialogWindow, d->okButton); } } } else if (CANCEL_BUTTON == d->pressedButton) { if (eventIsInsideButton(app, event, d->cancelButton)) { cancelAction(app); } else { if (d->cancelButton.pressed) { d->cancelButton.pressed = False; paintButton(app, d->dialogWindow, d->cancelButton); } } } d->pressedButton = NO_BUTTON; } } void handlePointerMotion(AppInfo *app, XEvent *event) { DialogInfo *d = app->dialog; if (NO_BUTTON == d->pressedButton) { return; } else if (OK_BUTTON == d->pressedButton) { if (eventIsInsideButton(app, event, d->okButton)) { if (!(d->okButton.pressed)) { d->okButton.pressed = True; paintButton(app, d->dialogWindow, d->okButton); } } else { if (d->okButton.pressed) { d->okButton.pressed = False; paintButton(app, d->dialogWindow, d->okButton); } } } else if (CANCEL_BUTTON == d->pressedButton) { if (eventIsInsideButton(app, event, d->cancelButton)) { if (!(d->cancelButton.pressed)) { d->cancelButton.pressed = True; paintButton(app, d->dialogWindow, d->cancelButton); } } else { if (d->cancelButton.pressed) { d->cancelButton.pressed = False; paintButton(app, d->dialogWindow, d->cancelButton); } } } } void handleInputTimeout(XtPointer data, XtIntervalId *timerId) { /* 'gcc -Wall' complains about 'timerId' being an unused parameter. * Tough. Xt forces us to have it here. Like it. */ AppInfo *app = (AppInfo *) data; if (app->inputTimeoutActive) { app->inputTimeoutActive = False; fprintf(stderr, "%s[%ld]: *Yawn*...timed out after %lu seconds.\n", app->appName, (long) app->pid, (app->inputTimeout / 1000)); exitApp(app, EXIT_STATUS_TIMEOUT); } } void cancelInputTimeout(AppInfo *app) { if (app->inputTimeoutActive) { app->inputTimeoutActive = False; XtRemoveTimeOut(app->inputTimeoutTimerId); } } int main(int argc, char **argv) { AppInfo app; XEvent event; memset(&app, 0, sizeof(app)); progclass = "SshAskpass"; app.toplevelShell = XtAppInitialize(&(app.appContext), progclass, NULL, 0, &argc, argv, defaults, NULL, 0); app.argc = argc; app.argv = argv; app.dpy = XtDisplay(app.toplevelShell); app.screen = DefaultScreenOfDisplay(app.dpy); app.rootWindow = RootWindowOfScreen(app.screen); app.black = BlackPixel(app.dpy, DefaultScreen(app.dpy)); app.white = WhitePixel(app.dpy, DefaultScreen(app.dpy)); app.colormap = DefaultColormapOfScreen(app.screen); app.resourceDb = XtDatabase(app.dpy); XtGetApplicationNameAndClass(app.dpy, &progname, &progclass); app.appName = progname; app.appClass = progclass; /* For resources.c. */ db = app.resourceDb; /* Seconds after which keyboard/pointer grab fail. */ app.grabFailTimeout = 5; /* Number of seconds to wait between grab attempts. */ app.grabRetryInterval = 1; app.pid = getpid(); { struct rlimit resourceLimit; int status; status = getrlimit(RLIMIT_CORE, &resourceLimit); if (-1 == status) { fprintf(stderr, "%s[%ld]: getrlimit failed (%s)\n", app.appName, (long) app.pid, strerror(errno)); exit(EXIT_STATUS_ERROR); } resourceLimit.rlim_cur = 0; status = setrlimit(RLIMIT_CORE, &resourceLimit); if (-1 == status) { fprintf(stderr, "%s[%ld]: setrlimit failed (%s)\n", app.appName, (long) app.pid, strerror(errno)); exit(EXIT_STATUS_ERROR); } } app.xResolution = WidthOfScreen(app.screen) * 1000 / WidthMMOfScreen(app.screen); app.yResolution = HeightOfScreen(app.screen) * 1000 / HeightMMOfScreen(app.screen); createDialog(&app); createGCs(&app); app.eventMask = 0; app.eventMask |= ExposureMask; app.eventMask |= ButtonPressMask; app.eventMask |= ButtonReleaseMask; app.eventMask |= Button1MotionMask; app.eventMask |= KeyPressMask; createDialogWindow(&app); XMapWindow(app.dpy, app.dialog->dialogWindow); if (app.inputTimeout > 0) { app.inputTimeoutActive = True; app.inputTimeoutTimerId = XtAppAddTimeOut(app.appContext, app.inputTimeout, handleInputTimeout, (XtPointer) &app); } while(True) { XtAppNextEvent(app.appContext, &event); switch (event.type) { case Expose: grabServer(&app); grabKeyboard(&app); grabPointer(&app); if (event.xexpose.count) { break; } paintDialog(&app); break; case ButtonPress: case ButtonRelease: handleButtonPress(&app, &event); break; case MotionNotify: handlePointerMotion(&app, &event); case KeyPress: handleKeyPress(&app, &event); break; case ClientMessage: if ((32 == event.xclient.format) && ((unsigned long) event.xclient.data.l[0] == app.wmDeleteWindowAtom)) { cancelAction(&app); } break; default: break; } } fprintf(stderr, "%s[%ld]: This should not happen.\n", app.appName, (long) app.pid); return(EXIT_STATUS_ANOMALY); } x11-ssh-askpass-1.2.4.1/drawing.h0100644000135600013560000000206507351324572016534 0ustar jmknoblejmknoble/* xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. No representations are made about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. */ /* 1999-Nov-21 Modified by Jim Knoble * Modifications: * - Extracted draw_shaded_rectangle() from xscreensaver source for use * in a separate application. Constructed separate header file. */ #ifndef _DRAWING_H_ #define _DRAWING_H_ #include void draw_shaded_rectangle (Display *dpy, Window window, int x, int y, int width, int height, int thickness, unsigned long top_color, unsigned long bottom_color); #endif /* _DRAWING_H_ */ x11-ssh-askpass-1.2.4.1/dynlist.h0100644000135600013560000000233307351324572016565 0ustar jmknoblejmknoble/* dynlist.h: Dynamic lists and buffers in C * created 1999-Jan-06 15:04 jmk * autodate: 2001-Sep-16 18:08 * * by Jim Knoble * Copyright (C) 1999,2000 Jim Knoble * * Disclaimer: * * The software is provided "as is", without warranty of any kind, * express or implied, including but not limited to the warranties of * merchantability, fitness for a particular purpose and * noninfringement. In no event shall the author(s) be liable for any * claim, damages or other liability, whether in an action of * contract, tort or otherwise, arising from, out of or in connection * with the software or the use or other dealings in the software. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation. */ #ifndef H_DYNLIST #define H_DYNLIST 1 #define APPEND_SUCCESS 1 #define APPEND_FAILURE 0 int append_to_list(char ***list_ptr, int *list_len, int *i, char *item); int append_to_buf(char **buf, int *buflen, int *i, int c); #endif /* H_DYNLIST */ x11-ssh-askpass-1.2.4.1/resources.h0100644000135600013560000000256407351324572017117 0ustar jmknoblejmknoble/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. No representations are made about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. */ /* 1999-Nov-21 Modified by Jim Knoble . * Modifications: * * - Made get_boolean_resource() accept a third parameter, default_value, * which determines the result of get_boolean_resource if either (a) * no such resource exists, or (b) the resource value does not conform * to the syntax of a boolean resource. * * - Same for get_integer_resource(). * * - 1999-Dec-24 Trimmed unused functions. */ #ifndef __XSCREENSAVER_RESOURCES_H__ #define __XSCREENSAVER_RESOURCES_H__ extern char *get_string_resource (char*,char*); extern Bool get_boolean_resource (char*,char*,Bool); extern int get_integer_resource (char*,char*,int); extern double get_float_resource (char*,char*); extern unsigned int get_pixel_resource (char*,char*,Display*,Colormap,unsigned int); #endif /* __XSCREENSAVER_RESOURCES_H__ */ x11-ssh-askpass-1.2.4.1/x11-ssh-askpass.h0100644000135600013560000001543107351324572017751 0ustar jmknoblejmknoble/* x11-ssh-askpass.h: A generic X11-based password dialog for OpenSSH. * created 1999-Nov-17 03:40 Jim Knoble * autodate: 2001-Sep-16 18:08 * * by Jim Knoble * Copyright (C) 1999,2000,2001 Jim Knoble * * Disclaimer: * * The software is provided "as is", without warranty of any kind, * express or implied, including but not limited to the warranties of * merchantability, fitness for a particular purpose and * noninfringement. In no event shall the author(s) be liable for any * claim, damages or other liability, whether in an action of * contract, tort or otherwise, arising from, out of or in connection * with the software or the use or other dealings in the software. * * Portions of this code are distantly derived from code in xscreensaver * by Jamie Zawinski . That code says: * * --------8<------------------------------------------------8<-------- * xscreensaver, Copyright (c) 1991-1999 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. No representations are made about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * --------8<------------------------------------------------8<-------- * * The remainder of this code falls under the same permissions and * provisions as those of the xscreensaver code. */ #ifndef H_X11_SSH_ASKPASS #define H_X11_SSH_ASKPASS #include #include #include #define EXIT_STATUS_ACCEPT 0 #define EXIT_STATUS_CANCEL 1 #define EXIT_STATUS_NO_MEMORY 2 #define EXIT_STATUS_ERROR 3 #define EXIT_STATUS_TIMEOUT 4 #define EXIT_STATUS_ANOMALY 127 typedef struct { Pixel foreground; Pixel background; Dimension width; Dimension height; Position x; Position y; } WidgetInfo; typedef struct { WidgetInfo w; Pixel topShadowColor; Pixel bottomShadowColor; Dimension shadowThickness; Pixel borderColor; Dimension borderWidth; Dimension interiorWidth; Dimension interiorHeight; Dimension horizontalSpacing; Dimension verticalSpacing; } Widget3dInfo; typedef struct TextObjectStruct { char *text; int textLength; int direction; int ascent; int descent; XCharStruct overall; struct TextObjectStruct *next; } TextObject; typedef struct { char *fullText; XFontStruct *font; TextObject *multiText; WidgetInfo w; } LabelInfo; typedef struct { Widget3dInfo w3; LabelInfo label; Bool pressed; } ButtonInfo; typedef struct { Widget3dInfo w3; int count; int current; int minimumCount; int maximumCount; } MasterIndicatorInfo; typedef struct { MasterIndicatorInfo *parent; WidgetInfo w; Bool isLit; } IndicatorElement; typedef struct { Window dialogWindow; XSizeHints *sizeHints; XWMHints *wmHints; XClassHint *classHints; XTextProperty windowName; char *title; Widget3dInfo w3; LabelInfo label; MasterIndicatorInfo indicator; IndicatorElement *indicators; ButtonInfo okButton; ButtonInfo cancelButton; int pressedButton; } DialogInfo; #define NO_BUTTON 0 #define OK_BUTTON 1 #define CANCEL_BUTTON 2 typedef struct { char *appName; char *appClass; int argc; char **argv; pid_t pid; char *buf; int bufSize; int bufIndex; Display *dpy; Screen *screen; Window rootWindow; Pixel black; Pixel white; Colormap colormap; /* Resolution measurements are normalized to dots/meter. */ long xResolution; long yResolution; long defaultXResolution; long defaultYResolution; long xFuzz; long yFuzz; XtAppContext appContext; Widget toplevelShell; XrmDatabase resourceDb; Atom wmDeleteWindowAtom; GC fillGC; GC borderGC; GC textGC; GC brightGC; GC dimGC; long eventMask; Bool grabKeyboard; Bool grabPointer; Bool grabServer; Bool isKeyboardGrabbed; Bool isPointerGrabbed; Bool isServerGrabbed; unsigned int grabFailTimeout; unsigned int grabRetryInterval; unsigned long inputTimeout; XtIntervalId inputTimeoutTimerId; Bool inputTimeoutActive; DialogInfo *dialog; } AppInfo; void outOfMemory(AppInfo *app, int line); void freeIf(void *p); void freeFontIf(AppInfo *app, XFontStruct *f); XFontStruct *getFontResource(AppInfo *app, char *instanceName, char *className); char *getStringResourceWithDefault(char *instanceName, char *className, char *defaultText); unsigned int getUnsignedIntegerResource(AppInfo *app, char *instanceName, char *className, unsigned int defaultValue); long getResolutionResource(AppInfo *app, char *instanceName, char *className, char *defaultResolutionSpec); void calcLabelTextExtents(LabelInfo *label); void calcTotalButtonExtents(ButtonInfo *button); void calcButtonExtents(ButtonInfo *button); void balanceButtonExtents(ButtonInfo *button1, ButtonInfo *button2); void calcButtonLabelPosition(ButtonInfo *button); Dimension scaleXDimension(AppInfo *app, Dimension unscaled); Dimension scaleYDimension(AppInfo *app, Dimension unscaled); void createDialog(AppInfo *app); void destroyDialog(AppInfo *app); void createDialogWindow(AppInfo *app); void createGCs(AppInfo *app); void destroyGCs(AppInfo *app); void paintLabel(AppInfo *app, Drawable draw, LabelInfo label); void paintButton(AppInfo *app, Drawable draw, ButtonInfo button); void paintIndicator(AppInfo *app, Drawable draw, IndicatorElement indicator); void updateIndicatorElement(AppInfo *app, int i); void updateIndicators(AppInfo *app, int condition); void paintDialog(AppInfo *app); #define GRAB_KEYBOARD 0 #define GRAB_POINTER 1 void performGrab(AppInfo *app, int grabType, char *grabTypeName, Bool shouldGrab, Bool *isGrabbed); void grabKeyboard(AppInfo *app); void ungrabKeyboard(AppInfo *app); void grabPointer(AppInfo *app); void ungrabPointer(AppInfo *app); void grabServer(AppInfo *app); void ungrabServer(AppInfo *app); void cleanUp(AppInfo *app); void exitApp(AppInfo *app, int exitCode); void acceptAction(AppInfo *app); void cancelAction(AppInfo *app); void backspacePassphrase(AppInfo *app); void erasePassphrase(AppInfo *app); void addToPassphrase(AppInfo *app, char c); void handleKeyPress(AppInfo *app, XEvent *event); Bool eventIsInsideButton(AppInfo *app, XEvent *event, ButtonInfo button); void handleButtonPress(AppInfo *app, XEvent *event); void handlePointerMotion(AppInfo *app, XEvent *event); void handleInputTimeout(XtPointer data, XtIntervalId *timerId); void cancelInputTimeout(AppInfo *app); #endif /* H_X11_SSH_ASKPASS */