On Fri, 21 Mar 2003 10:11:38 -0500
Ken Hornstein <[EMAIL PROTECTED]> wrote:
> >> Heh. You see why I choose to make xlock use the Kerberos call directly?
> >
> >Yep -- were these patches submitted to the XFree86 xlock or xlockmore?
> >Where could I find them?
>
> xlockmore; if you go to the xlockmore site and download the latest snapshot,
> they should be in there.
You may be interested to know that a hamfisted attempt to put your prompter
code into the Kerberized XDM worked a little:
- The password expiration message doesn't respond to the click
and stays up after login, acting as part of the background
- The password change dialog comes up, doesn't take text entry,
but seems to respond to clicks, although the text disappears
after the first message
I haven't ever done low level X (motif was bad enough), so I'm guessing
as to what to do, but I'll attach what I did to get it to compile (I added
it into server.c and put the declaration in krb5auth.c) . I had to paste in
the putTextFont as well with no changes. Basically, all the references to
"Scr[]" were either replaced with something else or commented out.
*shrug*
Jim*** xlock_prompter.c Fri Mar 21 12:23:55 2003
--- xlock_prompter.c.new Fri Mar 21 13:37:34 2003
***************
*** 1,11 ****
krb5_error_code
xlock_prompter(krb5_context context, void *data, const char *name,
const char *banner, int numprompts, krb5_prompt prompts[])
{
! Window parent = Scr[screen].window;
Window win, button;
GC gc;
XGCValues xgcv;
int lines = 0, max = 0, width, i, height, bwidth, bheight, x, y,
leave = 0, cp = 0, count;
XWindowAttributes xgwa;
--- 1,21 ----
+ #ifdef K5AUTH
+ #include <krb5.h>
+ #include <X11/X.h>
+ #include <X11/Xlib.h>
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xresource.h>
+
krb5_error_code
xlock_prompter(krb5_context context, void *data, const char *name,
const char *banner, int numprompts, krb5_prompt prompts[])
{
! /* Window parent = Scr[screen].window;*/
! Window parent = RootWindow(dpy, 0);
Window win, button;
GC gc;
XGCValues xgcv;
+ XFontStruct *planfont;
int lines = 0, max = 0, width, i, height, bwidth, bheight, x, y,
leave = 0, cp = 0, count;
XWindowAttributes xgwa;
***************
*** 15,20 ****
--- 25,31 ----
char buffer[20];
char *ok = "OK", *c;
const char *b;
+ char error_buf[64];
struct _promptinfo {
int x;
***************
*** 23,28 ****
--- 34,50 ----
int rp;
} *pi = NULL;
+ #define FALLBACK_FONTNAME "fixed"
+
+ planfont = XLoadQueryFont(dpy, FALLBACK_FONTNAME);
+ if (planfont == NULL) {
+ (void) snprintf(error_buf, sizeof(error_buf),
+ "%s: can not even find %s!!!\n",
+ "xlock", "fixed");
+ fprintf(stderr, "%s", error_buf);
+ }
+
+
if (numprompts > 0)
if (!(pi = malloc(sizeof(*pi) * numprompts)))
return ENOMEM;
***************
*** 64,70 ****
height = (lines + 1) * (planfont->ascent + planfont->descent + 2) + 40;
width = max + 20;
! (void) XGetWindowAttributes(dsp, Scr[screen].window, &xgwa);
if (width > xgwa.width) {
x = 0;
--- 86,92 ----
height = (lines + 1) * (planfont->ascent + planfont->descent + 2) + 40;
width = max + 20;
! (void) XGetWindowAttributes(dpy, parent, &xgwa);
if (width > xgwa.width) {
x = 0;
***************
*** 79,99 ****
y = (xgwa.height - height) / 2;
xswa.override_redirect = True;
! xswa.border_pixel = Scr[screen].white_pixel;
xswa.background_pixel = Scr[screen].white_pixel;
xswa.event_mask = KeyPressMask;
/*
* Create the main dialog window
*/
! win = XCreateWindow(dsp, parent, x, y, width, height, 2,
! CopyFromParent, CopyFromParent, Scr[screen].visual,
CWOverrideRedirect | CWBackPixel | CWBorderPixel |
CWEventMask, &xswa);
! XMapWindow(dsp, win);
! XRaiseWindow(dsp, win);
/*
* Create the OK button window
--- 101,122 ----
y = (xgwa.height - height) / 2;
xswa.override_redirect = True;
! /* xswa.border_pixel = Scr[screen].white_pixel;
xswa.background_pixel = Scr[screen].white_pixel;
+ */
xswa.event_mask = KeyPressMask;
/*
* Create the main dialog window
*/
! win = XCreateWindow(dpy, parent, x, y, width, height, 2,
! CopyFromParent, CopyFromParent, DefaultVisual(dpy, 0),
CWOverrideRedirect | CWBackPixel | CWBorderPixel |
CWEventMask, &xswa);
! XMapWindow(dpy, win);
! XRaiseWindow(dpy, win);
/*
* Create the OK button window
***************
*** 102,137 ****
bheight = planfont->ascent + planfont->descent + 10;
bwidth = XTextWidth(planfont, ok, strlen(ok)) + 10;
! xswa.border_pixel = Scr[screen].black_pixel;
xswa.event_mask = ButtonPressMask;
! button = XCreateWindow(dsp, win, (width - bwidth) / 2,
height - bheight - 5, bwidth, bheight, 2,
CopyFromParent, CopyFromParent,
! Scr[screen].visual, CWOverrideRedirect |
CWBackPixel | CWBorderPixel | CWEventMask,
&xswa);
! XMapWindow(dsp, button);
! XRaiseWindow(dsp, button);
x = 10;
y = 10 + planfont->ascent;
xgcv.font = planfont->fid;
xgcv.foreground = Scr[screen].black_pixel;
xgcv.background = Scr[screen].white_pixel;
! gc = XCreateGC(dsp, Scr[screen].window,
GCFont | GCForeground | GCBackground, &xgcv);
! putTextFont(dsp, win, planfont, gc, banner, 1, x, &x, &y);
for (i = 0; i < numprompts; i++) {
x = 10;
y += planfont->ascent + planfont->descent + 2;
! putTextFont(dsp, win, planfont, gc, prompts[i].prompt, 1,
x, &x, &y);
! putTextFont(dsp, win, planfont, gc, ": ", 1, x, &x, &y);
pi[i].x = pi[i].curx = x;
pi[i].y = y;
pi[i].rp = 0;
--- 125,162 ----
bheight = planfont->ascent + planfont->descent + 10;
bwidth = XTextWidth(planfont, ok, strlen(ok)) + 10;
! /* xswa.border_pixel = Scr[screen].black_pixel;*/
xswa.event_mask = ButtonPressMask;
! button = XCreateWindow(dpy, win, (width - bwidth) / 2,
height - bheight - 5, bwidth, bheight, 2,
CopyFromParent, CopyFromParent,
! DefaultVisual(dpy, 0), CWOverrideRedirect |
CWBackPixel | CWBorderPixel | CWEventMask,
&xswa);
! XMapWindow(dpy, button);
! XRaiseWindow(dpy, button);
x = 10;
y = 10 + planfont->ascent;
xgcv.font = planfont->fid;
+ /*
xgcv.foreground = Scr[screen].black_pixel;
xgcv.background = Scr[screen].white_pixel;
! */
! gc = XCreateGC(dpy, parent,
GCFont | GCForeground | GCBackground, &xgcv);
! putTextFont(dpy, win, planfont, gc, banner, 1, x, &x, &y);
for (i = 0; i < numprompts; i++) {
x = 10;
y += planfont->ascent + planfont->descent + 2;
! putTextFont(dpy, win, planfont, gc, prompts[i].prompt, 1,
x, &x, &y);
! putTextFont(dpy, win, planfont, gc, ": ", 1, x, &x, &y);
pi[i].x = pi[i].curx = x;
pi[i].y = y;
pi[i].rp = 0;
***************
*** 141,150 ****
x = 5;
y = 5 + planfont->ascent;
! putTextFont(dsp, button, planfont, gc, ok, 1, x, &x, &y);
while (leave == 0) {
! XNextEvent(dsp, &event);
switch (event.type) {
--- 166,175 ----
x = 5;
y = 5 + planfont->ascent;
! putTextFont(dpy, button, planfont, gc, ok, 1, x, &x, &y);
while (leave == 0) {
! XNextEvent(dpy, &event);
switch (event.type) {
***************
*** 181,187 ****
*/
if (numprompts == 0) {
! XBell(dsp, 100);
break;
}
--- 206,212 ----
*/
if (numprompts == 0) {
! XBell(dpy, 100);
break;
}
***************
*** 206,219 ****
if (keysym == XK_BackSpace || keysym == XK_Delete) {
if (pi[cp].rp == 0) {
! XBell(dsp, 100);
break;
}
prompts[cp].reply->data[--pi[cp].rp] = '\0';
if (pi[cp].rp < 32) {
pi[cp].curx -= XTextWidth(planfont,
"*", 1);
! XClearArea(dsp, win, pi[cp].curx,
pi[cp].y - planfont->ascent,
0, planfont->ascent +
planfont->descent, False);
--- 231,244 ----
if (keysym == XK_BackSpace || keysym == XK_Delete) {
if (pi[cp].rp == 0) {
! XBell(dpy, 100);
break;
}
prompts[cp].reply->data[--pi[cp].rp] = '\0';
if (pi[cp].rp < 32) {
pi[cp].curx -= XTextWidth(planfont,
"*", 1);
! XClearArea(dpy, win, pi[cp].curx,
pi[cp].y - planfont->ascent,
0, planfont->ascent +
planfont->descent, False);
***************
*** 229,235 ****
switch (buffer[i]) {
case '\003':
case '\025':
! XClearArea(dsp, win, pi[cp].x,
pi[cp].y - planfont->ascent,
0, planfont->ascent +
planfont->descent, False);
--- 254,260 ----
switch (buffer[i]) {
case '\003':
case '\025':
! XClearArea(dpy, win, pi[cp].x,
pi[cp].y - planfont->ascent,
0, planfont->ascent +
planfont->descent, False);
***************
*** 241,253 ****
default:
if (pi[cp].rp + 1 >=
prompts[cp].reply->length) {
! XBell(dsp, 100);
break;
}
prompts[cp].reply->data[pi[cp].rp++] =
buffer[i];
if (pi[cp].rp <= 32) {
! putTextFont(dsp, win, planfont,
gc, "*", 1,
pi[cp].curx,
&pi[cp].curx,
--- 266,278 ----
default:
if (pi[cp].rp + 1 >=
prompts[cp].reply->length) {
! XBell(dpy, 100);
break;
}
prompts[cp].reply->data[pi[cp].rp++] =
buffer[i];
if (pi[cp].rp <= 32) {
! putTextFont(dpy, win, planfont,
gc, "*", 1,
pi[cp].curx,
&pi[cp].curx,
***************
*** 269,281 ****
if (pi)
free(pi);
! XDestroyWindow(dsp, win);
! XFreeGC(dsp, gc);
for (i = 0; i < numprompts; i++)
prompts[i].reply->length = strlen(prompts[i].reply->data);
return 0;
}
! #endif /* HAVE_KRB5 */
! #endif /* STANDALONE */
--- 294,305 ----
if (pi)
free(pi);
! XDestroyWindow(dpy, win);
! XFreeGC(dpy, gc);
for (i = 0; i < numprompts; i++)
prompts[i].reply->length = strlen(prompts[i].reply->data);
return 0;
}
! #endif /* K5AUTH */
________________________________________________
Kerberos mailing list [EMAIL PROTECTED]
https://mailman.mit.edu/mailman/listinfo/kerberos