Lots of changes on the password dialog and a bit of a performance improvement

on the main dialog while instant applying the changes to the EDS database.
This commit is contained in:
Diego González 2005-06-15 00:25:55 +00:00
parent 122c552f5c
commit a6352fc137
16 changed files with 3495 additions and 175 deletions

View file

@ -1,3 +1,14 @@
2005-06-15 Diego Gonzalez <diego@pemas.net>
* gnome-about-me.glade: Change the look of the "change Password"
dialog.
* gnome-about-me-password.c: Change completely the inner workings
and add a way to meausure the quality of the password.
* cracklib/*: code from cracklib2 to check the quality of the
password.
Several other changes...
2005-05-16 Olav Vitters <olav@bkor.dhs.org>
* gnome-about-me.glade: Remove garbage text. Patch by Benjamin

View file

@ -1,15 +1,20 @@
SUBDIRS = cracklib
bin_PROGRAMS = gnome-about-me
pixmapdir = $(GNOMECC_PIXMAPS_DIR)
pixmap_DATA = \
gnome-about-me.png
pixmap_DATA = \
gnome-about-me.png \
gnome-about-me-bulb-on.png \
gnome-about-me-bulb-off.png
gnome_about_me_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(LIBEBOOK_LIBS) -lutil
gnome_about_me_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(LIBEBOOK_LIBS) -lutil cracklib/libcracklib.a
gnome_about_me_SOURCES = \
e-util-marshal.c \
e-util-marshal.h \
eel-alert-dialog.c \
e-util-marshal.c \
e-util-marshal.h \
gnome-about-me-password.c \
e-image-chooser.c \
e-image-chooser.c \
gnome-about-me.c
e-util-marshal.h: e-util-marshal.list

View file

@ -0,0 +1,782 @@
/*
* This program is copyright Alec Muffett 1993. The author disclaims all
* responsibility or liability with respect to it's usage or its effect
* upon hardware or computer systems, and maintains copyright as set out
* in the "LICENCE" document which accompanies distributions of Crack v4.0
* and upwards.
*/
/* Diego Gonzalez <diego@pemas.net>
* 13-06-2005: Modify funcions to use gettext
*/
static char vers_id[] = "fascist.c : v2.3p3 Alec Muffett 14 dec 1997";
#include "packer.h"
#include <glib/gi18n.h>
#include <sys/types.h>
#include <string.h>
#include <pwd.h>
#define ISSKIP(x) (isspace(x) || ispunct(x))
#define MINDIFF 5
#define MINLEN 6
#define MAXSTEP 4
#undef DEBUG
#undef DEBUG2
extern char *Reverse();
extern char *Lowercase();
static char *r_destructors[] = {
":", /* noop - must do this to test raw word. */
#ifdef DEBUG2
(char *) 0,
#endif
"[", /* trimming leading/trailing junk */
"]",
"[[",
"]]",
"[[[",
"]]]",
"/?p@?p", /* purging out punctuation/symbols/junk */
"/?s@?s",
"/?X@?X",
/* attempt reverse engineering of password strings */
"/$s$s",
"/$s$s/0s0o",
"/$s$s/0s0o/2s2a",
"/$s$s/0s0o/2s2a/3s3e",
"/$s$s/0s0o/2s2a/3s3e/5s5s",
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1i",
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1l",
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1i/4s4a",
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1i/4s4h",
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1l/4s4a",
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1l/4s4h",
"/$s$s/0s0o/2s2a/3s3e/5s5s/4s4a",
"/$s$s/0s0o/2s2a/3s3e/5s5s/4s4h",
"/$s$s/0s0o/2s2a/3s3e/5s5s/4s4a",
"/$s$s/0s0o/2s2a/3s3e/5s5s/4s4h",
"/$s$s/0s0o/2s2a/3s3e/1s1i",
"/$s$s/0s0o/2s2a/3s3e/1s1l",
"/$s$s/0s0o/2s2a/3s3e/1s1i/4s4a",
"/$s$s/0s0o/2s2a/3s3e/1s1i/4s4h",
"/$s$s/0s0o/2s2a/3s3e/1s1l/4s4a",
"/$s$s/0s0o/2s2a/3s3e/1s1l/4s4h",
"/$s$s/0s0o/2s2a/3s3e/4s4a",
"/$s$s/0s0o/2s2a/3s3e/4s4h",
"/$s$s/0s0o/2s2a/3s3e/4s4a",
"/$s$s/0s0o/2s2a/3s3e/4s4h",
"/$s$s/0s0o/2s2a/5s5s",
"/$s$s/0s0o/2s2a/5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",
"/2s2a/1s1l",
"/2s2a/1s1i/4s4a",
"/2s2a/1s1i/4s4h",
"/2s2a/1s1l/4s4a",
"/2s2a/1s1l/4s4h",
"/2s2a/4s4a",
"/2s2a/4s4h",
"/2s2a/4s4a",
"/2s2a/4s4h",
"/3s3e",
"/3s3e/5s5s",
"/3s3e/5s5s/1s1i",
"/3s3e/5s5s/1s1l",
"/3s3e/5s5s/1s1i/4s4a",
"/3s3e/5s5s/1s1i/4s4h",
"/3s3e/5s5s/1s1l/4s4a",
"/3s3e/5s5s/1s1l/4s4h",
"/3s3e/5s5s/4s4a",
"/3s3e/5s5s/4s4h",
"/3s3e/5s5s/4s4a",
"/3s3e/5s5s/4s4h",
"/3s3e/1s1i",
"/3s3e/1s1l",
"/3s3e/1s1i/4s4a",
"/3s3e/1s1i/4s4h",
"/3s3e/1s1l/4s4a",
"/3s3e/1s1l/4s4h",
"/3s3e/4s4a",
"/3s3e/4s4h",
"/3s3e/4s4a",
"/3s3e/4s4h",
"/5s5s",
"/5s5s/1s1i",
"/5s5s/1s1l",
"/5s5s/1s1i/4s4a",
"/5s5s/1s1i/4s4h",
"/5s5s/1s1l/4s4a",
"/5s5s/1s1l/4s4h",
"/5s5s/4s4a",
"/5s5s/4s4h",
"/5s5s/4s4a",
"/5s5s/4s4h",
"/1s1i",
"/1s1l",
"/1s1i/4s4a",
"/1s1i/4s4h",
"/1s1l/4s4a",
"/1s1l/4s4h",
"/4s4a",
"/4s4h",
"/4s4a",
"/4s4h",
/* done */
(char *) 0
};
static char *r_constructors[] = {
":",
#ifdef DEBUG2
(char *) 0,
#endif
"r",
"d",
"f",
"dr",
"fr",
"rf",
(char *) 0
};
int
GTry(char *rawtext, char *password)
{
int i;
int len;
char *mp;
/* use destructors to turn password into rawtext */
/* note use of Reverse() to save duplicating all rules */
len = strlen(password);
for (i = 0; r_destructors[i]; i++)
{
if (!(mp = Mangle(password, r_destructors[i])))
{
continue;
}
#ifdef DEBUG
printf("%-16s = %-16s (destruct %s)\n", mp, rawtext, r_destructors[i]);
#endif
if (!strncmp(mp, rawtext, len))
{
return (1);
}
#ifdef DEBUG
printf("%-16s = %-16s (destruct %s reversed)\n", Reverse(mp), rawtext, r_destructors[i]);
#endif
if (!strncmp(Reverse(mp), rawtext, len))
{
return (1);
}
}
for (i = 0; r_constructors[i]; i++)
{
if (!(mp = Mangle(rawtext, r_constructors[i])))
{
continue;
}
#ifdef DEBUG
printf("%-16s = %-16s (construct %s)\n", mp, password, r_constructors[i]);
#endif
if (!strncmp(mp, password, len))
{
return (1);
}
}
return (0);
}
char *
FascistGecos(char *password, int uid)
{
int i;
int j;
int wc;
char *ptr;
int gwords;
struct passwd *pwp;
char gbuffer[STRINGSIZE];
char tbuffer[STRINGSIZE];
char *uwords[STRINGSIZE];
char longbuffer[STRINGSIZE * 2];
if (!(pwp = getpwuid(uid)))
{
return (g_strdup (_("You are not registered in the password file")));
}
/* lets get really paranoid and assume a dangerously long gecos entry */
strncpy(tbuffer, pwp->pw_name, STRINGSIZE);
tbuffer[STRINGSIZE-1] = '\0';
if (GTry(tbuffer, password))
{
return (g_strdup (_("Password based on your username")));
}
/* it never used to be that you got passwd strings > 1024 chars, but now... */
strncpy(tbuffer, pwp->pw_gecos, STRINGSIZE);
tbuffer[STRINGSIZE-1] = '\0';
strcpy(gbuffer, Lowercase(tbuffer));
wc = 0;
ptr = gbuffer;
gwords = 0;
uwords[0] = (char *)0;
while (*ptr)
{
while (*ptr && ISSKIP(*ptr))
{
ptr++;
}
if (ptr != gbuffer)
{
ptr[-1] = '\0';
}
gwords++;
uwords[wc++] = ptr;
if (wc == STRINGSIZE)
{
uwords[--wc] = (char *) 0; /* to hell with it */
break;
} else
{
uwords[wc] = (char *) 0;
}
while (*ptr && !ISSKIP(*ptr))
{
ptr++;
}
if (*ptr)
{
*(ptr++) = '\0';
}
}
#ifdef DEBUG
for (i = 0; uwords[i]; i++)
{
printf ("gecosword %s\n", uwords[i]);
}
#endif
for (i = 0; uwords[i]; i++)
{
if (GTry(uwords[i], password))
{
return (g_strdup (_("Password based upon your password entry")));
}
}
/* since uwords are taken from gbuffer, no uword can be longer than gbuffer */
for (j = 1; (j < gwords) && uwords[j]; j++)
{
for (i = 0; i < j; i++)
{
strcpy(longbuffer, uwords[i]);
strcat(longbuffer, uwords[j]);
if (GTry(longbuffer, password))
{
return (g_strdup (_("Password derived from your password entry")));
}
strcpy(longbuffer, uwords[j]);
strcat(longbuffer, uwords[i]);
if (GTry(longbuffer, password))
{
return (g_strdup (_("Password derived from your password entry")));
}
longbuffer[0] = uwords[i][0];
longbuffer[1] = '\0';
strcat(longbuffer, uwords[j]);
if (GTry(longbuffer, password))
{
return (g_strdup (_("Password derivable from your password entry")));
}
longbuffer[0] = uwords[j][0];
longbuffer[1] = '\0';
strcat(longbuffer, uwords[i]);
if (GTry(longbuffer, password))
{
return (g_strdup (_("Password derivable from your password entry")));
}
}
}
return ((char *) 0);
}
char *
FascistLook(PWDICT *pwp, char *instring)
{
int i;
char *ptr;
char *jptr;
char junk[STRINGSIZE];
char *password;
char rpassword[STRINGSIZE];
int32 notfound;
notfound = PW_WORDS(pwp);
/* already truncated if from FascistCheck() */
/* but pretend it wasn't ... */
strncpy(rpassword, instring, TRUNCSTRINGSIZE);
rpassword[TRUNCSTRINGSIZE - 1] = '\0';
password = rpassword;
if (strlen(password) < 4)
{
return (g_strdup (_("Password is way too short")));
}
if (strlen(password) < MINLEN)
{
return (g_strdup (_("Password is too short")));
}
jptr = junk;
*jptr = '\0';
for (i = 0; i < STRINGSIZE && password[i]; i++)
{
if (!strchr(junk, password[i]))
{
*(jptr++) = password[i];
*jptr = '\0';
}
}
if (strlen(junk) < MINDIFF)
{
return (g_strdup (_("Password does not contain enough different characters")));
}
strcpy(password, Lowercase(password));
Trim(password);
while (*password && isspace(*password))
{
password++;
}
if (!*password)
{
return (g_strdup (_("Password is all whitespace")));
}
i = 0;
ptr = password;
while (ptr[0] && ptr[1])
{
if ((ptr[1] == (ptr[0] + 1)) || (ptr[1] == (ptr[0] - 1)))
{
i++;
}
ptr++;
}
if (i > MAXSTEP)
{
return (g_strdup (_("Password is too simplistic/systematic")));
}
if (PMatch("aadddddda", password)) /* smirk */
{
return (g_strdup (_("Password looks like a National Insurance number.")));
}
if (ptr = FascistGecos(password, getuid()))
{
return (ptr);
}
/* it should be safe to use Mangle with its reliance on STRINGSIZE
since password cannot be longer than TRUNCSTRINGSIZE;
nonetheless this is not an elegant solution */
for (i = 0; r_destructors[i]; i++)
{
char *a;
if (!(a = Mangle(password, r_destructors[i])))
{
continue;
}
#ifdef DEBUG
printf("%-16s (dict)\n", a);
#endif
if (FindPW(pwp, a) != notfound)
{
return (g_strdup (_("Password based on a dictionary word")));
}
}
strcpy(password, Reverse(password));
for (i = 0; r_destructors[i]; i++)
{
char *a;
if (!(a = Mangle(password, r_destructors[i])))
{
continue;
}
#ifdef DEBUG
printf("%-16s (reversed dict)\n", a);
#endif
if (FindPW(pwp, a) != notfound)
{
return (g_strdup (_("it is based on a (reversed) dictionary word")));
}
}
return ((char *) 0);
}
char *
FascistCheck (char *password, char *path)
{
static char lastpath[STRINGSIZE];
static PWDICT *pwp;
char pwtrunced[STRINGSIZE];
/* security problem: assume we may have been given a really long
password (buffer attack) and so truncate it to a workable size;
try to define workable size as something from which we cannot
extend a buffer beyond its limits in the rest of the code */
strncpy(pwtrunced, password, TRUNCSTRINGSIZE);
pwtrunced[TRUNCSTRINGSIZE - 1] = '\0'; /* enforce */
/* perhaps someone should put something here to check if password
is really long and syslog() a message denoting buffer attacks? */
if (pwp && strncmp(lastpath, path, STRINGSIZE))
{
PWClose(pwp);
pwp = (PWDICT *)0;
}
if (!pwp)
{
if (!(pwp = PWOpen(path, "r")))
{
perror("PWOpen");
exit(-1);
}
strncpy(lastpath, path, STRINGSIZE);
}
return (FascistLook(pwp, pwtrunced));
}

View file

@ -0,0 +1,60 @@
/*
* This program is copyright Alec Muffett 1993. The author disclaims all
* responsibility or liability with respect to it's usage or its effect
* upon hardware or computer systems, and maintains copyright as set out
* in the "LICENCE" document which accompanies distributions of Crack v4.0
* and upwards.
*/
#include <stdio.h>
#include <ctype.h>
#define STRINGSIZE 1024
#define TRUNCSTRINGSIZE (STRINGSIZE/4)
typedef unsigned char int8;
typedef unsigned short int int16;
typedef unsigned long int int32;
#ifndef NUMWORDS
#define NUMWORDS 16
#endif
#define MAXWORDLEN 32
#define MAXBLOCKLEN (MAXWORDLEN * NUMWORDS)
struct pi_header
{
int32 pih_magic;
int32 pih_numwords;
int16 pih_blocklen;
int16 pih_pad;
};
typedef struct
{
FILE *ifp;
FILE *dfp;
FILE *wfp;
int32 flags;
#define PFOR_WRITE 0x0001
#define PFOR_FLUSH 0x0002
#define PFOR_USEHWMS 0x0004
int32 hwms[256];
struct pi_header header;
int count;
char data[NUMWORDS][MAXWORDLEN];
} PWDICT;
#define PW_WORDS(x) ((x)->header.pih_numwords)
#define PIH_MAGIC 0x70775631
extern PWDICT *PWOpen();
extern char *Mangle();
extern char *FascistCheck();
#define CRACK_TOLOWER(a) (isupper(a)?tolower(a):(a))
#define CRACK_TOUPPER(a) (islower(a)?toupper(a):(a))
#define STRCMP(a,b) strcmp((a),(b))

View file

@ -0,0 +1,356 @@
/*
* This program is copyright Alec Muffett 1993. The author disclaims all
* responsibility or liability with respect to it's usage or its effect
* upon hardware or computer systems, and maintains copyright as set out
* in the "LICENCE" document which accompanies distributions of Crack v4.0
* and upwards.
*/
#include "packer.h"
static char vers_id[] = "packlib.c : v2.3p2 Alec Muffett 18 May 1993";
PWDICT *
PWOpen(prefix, mode)
char *prefix;
char *mode;
{
int32 i;
static PWDICT pdesc;
char iname[STRINGSIZE];
char dname[STRINGSIZE];
char wname[STRINGSIZE];
char buffer[STRINGSIZE];
FILE *dfp;
FILE *ifp;
FILE *wfp;
if (pdesc.header.pih_magic == PIH_MAGIC)
{
fprintf(stderr, "%s: another dictionary already open\n", prefix);
return ((PWDICT *) 0);
}
memset(&pdesc, '\0', sizeof(pdesc));
sprintf(iname, "%s.pwi", prefix);
sprintf(dname, "%s.pwd", prefix);
sprintf(wname, "%s.hwm", prefix);
if (!(pdesc.dfp = fopen(dname, mode)))
{
perror(dname);
return ((PWDICT *) 0);
}
if (!(pdesc.ifp = fopen(iname, mode)))
{
fclose(pdesc.dfp);
perror(iname);
return ((PWDICT *) 0);
}
if (pdesc.wfp = fopen(wname, mode))
{
pdesc.flags |= PFOR_USEHWMS;
}
ifp = pdesc.ifp;
dfp = pdesc.dfp;
wfp = pdesc.wfp;
if (mode[0] == 'w')
{
pdesc.flags |= PFOR_WRITE;
pdesc.header.pih_magic = PIH_MAGIC;
pdesc.header.pih_blocklen = NUMWORDS;
pdesc.header.pih_numwords = 0;
fwrite((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp);
} else
{
pdesc.flags &= ~PFOR_WRITE;
if (!fread((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp))
{
fprintf(stderr, "%s: error reading header\n", prefix);
pdesc.header.pih_magic = 0;
fclose(ifp);
fclose(dfp);
return ((PWDICT *) 0);
}
if (pdesc.header.pih_magic != PIH_MAGIC)
{
fprintf(stderr, "%s: magic mismatch\n", prefix);
pdesc.header.pih_magic = 0;
fclose(ifp);
fclose(dfp);
return ((PWDICT *) 0);
}
if (pdesc.header.pih_blocklen != NUMWORDS)
{
fprintf(stderr, "%s: size mismatch\n", prefix);
pdesc.header.pih_magic = 0;
fclose(ifp);
fclose(dfp);
return ((PWDICT *) 0);
}
if (pdesc.flags & PFOR_USEHWMS)
{
if (fread(pdesc.hwms, 1, sizeof(pdesc.hwms), wfp) != sizeof(pdesc.hwms))
{
pdesc.flags &= ~PFOR_USEHWMS;
}
}
}
return (&pdesc);
}
int
PWClose(pwp)
PWDICT *pwp;
{
if (pwp->header.pih_magic != PIH_MAGIC)
{
fprintf(stderr, "PWClose: close magic mismatch\n");
return (-1);
}
if (pwp->flags & PFOR_WRITE)
{
pwp->flags |= PFOR_FLUSH;
PutPW(pwp, (char *) 0); /* flush last index if necess */
if (fseek(pwp->ifp, 0L, 0))
{
fprintf(stderr, "index magic fseek failed\n");
return (-1);
}
if (!fwrite((char *) &pwp->header, sizeof(pwp->header), 1, pwp->ifp))
{
fprintf(stderr, "index magic fwrite failed\n");
return (-1);
}
if (pwp->flags & PFOR_USEHWMS)
{
int i;
for (i=1; i<=0xff; i++)
{
if (!pwp->hwms[i])
{
pwp->hwms[i] = pwp->hwms[i-1];
}
#ifdef DEBUG
printf("hwm[%02x] = %d\n", i, pwp->hwms[i]);
#endif
}
fwrite(pwp->hwms, 1, sizeof(pwp->hwms), pwp->wfp);
}
}
fclose(pwp->ifp);
fclose(pwp->dfp);
pwp->header.pih_magic = 0;
return (0);
}
int
PutPW(pwp, string)
PWDICT *pwp;
char *string;
{
if (!(pwp->flags & PFOR_WRITE))
{
return (-1);
}
if (string)
{
strncpy(pwp->data[pwp->count], string, MAXWORDLEN);
pwp->data[pwp->count][MAXWORDLEN - 1] = '\0';
pwp->hwms[string[0] & 0xff]= pwp->header.pih_numwords;
++(pwp->count);
++(pwp->header.pih_numwords);
} else if (!(pwp->flags & PFOR_FLUSH))
{
return (-1);
}
if ((pwp->flags & PFOR_FLUSH) || !(pwp->count % NUMWORDS))
{
int i;
int32 datum;
register char *ostr;
datum = (int32) ftell(pwp->dfp);
fwrite((char *) &datum, sizeof(datum), 1, pwp->ifp);
fputs(pwp->data[0], pwp->dfp);
putc(0, pwp->dfp);
ostr = pwp->data[0];
for (i = 1; i < NUMWORDS; i++)
{
register int j;
register char *nstr;
nstr = pwp->data[i];
if (nstr[0])
{
for (j = 0; ostr[j] && nstr[j] && (ostr[j] == nstr[j]); j++);
putc(j & 0xff, pwp->dfp);
fputs(nstr + j, pwp->dfp);
}
putc(0, pwp->dfp);
ostr = nstr;
}
memset(pwp->data, '\0', sizeof(pwp->data));
pwp->count = 0;
}
return (0);
}
char *
GetPW(pwp, number)
PWDICT *pwp;
int32 number;
{
int32 datum;
register int i;
register char *ostr;
register char *nstr;
register char *bptr;
char buffer[NUMWORDS * MAXWORDLEN];
static char data[NUMWORDS][MAXWORDLEN];
static int32 prevblock = 0xffffffff;
int32 thisblock;
thisblock = number / NUMWORDS;
if (prevblock == thisblock)
{
return (data[number % NUMWORDS]);
}
if (fseek(pwp->ifp, sizeof(struct pi_header) + (thisblock * sizeof(int32)), 0))
{
perror("(index fseek failed)");
return ((char *) 0);
}
if (!fread((char *) &datum, sizeof(datum), 1, pwp->ifp))
{
perror("(index fread failed)");
return ((char *) 0);
}
if (fseek(pwp->dfp, datum, 0))
{
perror("(data fseek failed)");
return ((char *) 0);
}
if (!fread(buffer, 1, sizeof(buffer), pwp->dfp))
{
perror("(data fread failed)");
return ((char *) 0);
}
prevblock = thisblock;
bptr = buffer;
for (ostr = data[0]; *(ostr++) = *(bptr++); /* nothing */ );
ostr = data[0];
for (i = 1; i < NUMWORDS; i++)
{
nstr = data[i];
strcpy(nstr, ostr);
ostr = nstr + *(bptr++);
while (*(ostr++) = *(bptr++));
ostr = nstr;
}
return (data[number % NUMWORDS]);
}
int32
FindPW(pwp, string)
PWDICT *pwp;
char *string;
{
register int32 lwm;
register int32 hwm;
register int32 middle;
register char *this;
int idx;
if (pwp->flags & PFOR_USEHWMS)
{
idx = string[0] & 0xff;
lwm = idx ? pwp->hwms[idx - 1] : 0;
hwm = pwp->hwms[idx];
} else
{
lwm = 0;
hwm = PW_WORDS(pwp) - 1;
}
#ifdef DEBUG
printf("---- %lu, %lu ----\n", lwm, hwm);
#endif
for (;;)
{
int cmp;
#ifdef DEBUG
printf("%lu, %lu\n", lwm, hwm);
#endif
middle = lwm + ((hwm - lwm + 1) / 2);
if (middle == hwm)
{
break;
}
this = GetPW(pwp, middle);
cmp = strcmp(string, this); /* INLINE ? */
if (cmp < 0)
{
hwm = middle;
} else if (cmp > 0)
{
lwm = middle;
} else
{
return (middle);
}
}
return (PW_WORDS(pwp));
}

View file

@ -0,0 +1,824 @@
/*
* This program is copyright Alec Muffett 1993. The author disclaims all
* responsibility or liability with respect to it's usage or its effect
* upon hardware or computer systems, and maintains copyright as set out
* in the "LICENCE" document which accompanies distributions of Crack v4.0
* and upwards.
*/
static char vers_id[] = "rules.c : v5.0p3 Alec Muffett 20 May 1993";
#include "packer.h"
static void
Debug(val, a, b, c, d, e, f, g)
int val;
char *a, *b, *c, *d, *e, *f, *g;
{
fprintf(stderr, a, b, c, d, e, f);
}
#define RULE_NOOP ':'
#define RULE_PREPEND '^'
#define RULE_APPEND '$'
#define RULE_REVERSE 'r'
#define RULE_UPPERCASE 'u'
#define RULE_LOWERCASE 'l'
#define RULE_PLURALISE 'p'
#define RULE_CAPITALISE 'c'
#define RULE_DUPLICATE 'd'
#define RULE_REFLECT 'f'
#define RULE_SUBSTITUTE 's'
#define RULE_MATCH '/'
#define RULE_NOT '!'
#define RULE_LT '<'
#define RULE_GT '>'
#define RULE_EXTRACT 'x'
#define RULE_OVERSTRIKE 'o'
#define RULE_INSERT 'i'
#define RULE_EQUALS '='
#define RULE_PURGE '@'
#define RULE_CLASS '?' /* class rule? socialist ethic in cracker? */
#define RULE_DFIRST '['
#define RULE_DLAST ']'
#define RULE_MFIRST '('
#define RULE_MLAST ')'
int
Suffix(myword, suffix)
char *myword;
char *suffix;
{
register int i;
register int j;
i = strlen(myword);
j = strlen(suffix);
if (i > j)
{
return (STRCMP((myword + i - j), suffix));
} else
{
return (-1);
}
}
char *
Reverse(str) /* return a pointer to a reversal */
register char *str;
{
register int i;
register int j;
static char area[STRINGSIZE];
j = i = strlen(str);
while (*str)
{
area[--i] = *str++;
}
area[j] = '\0';
return (area);
}
char *
Uppercase(str) /* return a pointer to an uppercase */
register char *str;
{
register char *ptr;
static char area[STRINGSIZE];
ptr = area;
while (*str)
{
*(ptr++) = CRACK_TOUPPER(*str);
str++;
}
*ptr = '\0';
return (area);
}
char *
Lowercase(str) /* return a pointer to an lowercase */
register char *str;
{
register char *ptr;
static char area[STRINGSIZE];
ptr = area;
while (*str)
{
*(ptr++) = CRACK_TOLOWER(*str);
str++;
}
*ptr = '\0';
return (area);
}
char *
Capitalise(str) /* return a pointer to an capitalised */
register char *str;
{
register char *ptr;
static char area[STRINGSIZE];
ptr = area;
while (*str)
{
*(ptr++) = CRACK_TOLOWER(*str);
str++;
}
*ptr = '\0';
area[0] = CRACK_TOUPPER(area[0]);
return (area);
}
char *
Pluralise(string) /* returns a pointer to a plural */
register char *string;
{
register int length;
static char area[STRINGSIZE];
length = strlen(string);
strcpy(area, string);
if (!Suffix(string, "ch") ||
!Suffix(string, "ex") ||
!Suffix(string, "ix") ||
!Suffix(string, "sh") ||
!Suffix(string, "ss"))
{
/* bench -> benches */
strcat(area, "es");
} else if (length > 2 && string[length - 1] == 'y')
{
if (strchr("aeiou", string[length - 2]))
{
/* alloy -> alloys */
strcat(area, "s");
} else
{
/* gully -> gullies */
strcpy(area + length - 1, "ies");
}
} else if (string[length - 1] == 's')
{
/* bias -> biases */
strcat(area, "es");
} else
{
/* catchall */
strcat(area, "s");
}
return (area);
}
char *
Substitute(string, old, new) /* returns pointer to a swapped about copy */
register char *string;
register char old;
register char new;
{
register char *ptr;
static char area[STRINGSIZE];
ptr = area;
while (*string)
{
*(ptr++) = (*string == old ? new : *string);
string++;
}
*ptr = '\0';
return (area);
}
char *
Purge(string, target) /* returns pointer to a purged copy */
register char *string;
register char target;
{
register char *ptr;
static char area[STRINGSIZE];
ptr = area;
while (*string)
{
if (*string != target)
{
*(ptr++) = *string;
}
string++;
}
*ptr = '\0';
return (area);
}
/* -------- CHARACTER CLASSES START HERE -------- */
/*
* this function takes two inputs, a class identifier and a character, and
* returns non-null if the given character is a member of the class, based
* upon restrictions set out below
*/
int
MatchClass(class, input)
register char class;
register char input;
{
register char c;
register int retval;
retval = 0;
switch (class)
{
/* ESCAPE */
case '?': /* ?? -> ? */
if (input == '?')
{
retval = 1;
}
break;
/* ILLOGICAL GROUPINGS (ie: not in ctype.h) */
case 'V':
case 'v': /* vowels */
c = CRACK_TOLOWER(input);
if (strchr("aeiou", c))
{
retval = 1;
}
break;
case 'C':
case 'c': /* consonants */
c = CRACK_TOLOWER(input);
if (strchr("bcdfghjklmnpqrstvwxyz", c))
{
retval = 1;
}
break;
case 'W':
case 'w': /* whitespace */
if (strchr("\t ", input))
{
retval = 1;
}
break;
case 'P':
case 'p': /* punctuation */
if (strchr(".`,:;'!?\"", input))
{
retval = 1;
}
break;
case 'S':
case 's': /* symbols */
if (strchr("$%%^&*()-_+=|\\[]{}#@/~", input))
{
retval = 1;
}
break;
/* LOGICAL GROUPINGS */
case 'L':
case 'l': /* lowercase */
if (islower(input))
{
retval = 1;
}
break;
case 'U':
case 'u': /* uppercase */
if (isupper(input))
{
retval = 1;
}
break;
case 'A':
case 'a': /* alphabetic */
if (isalpha(input))
{
retval = 1;
}
break;
case 'X':
case 'x': /* alphanumeric */
if (isalnum(input))
{
retval = 1;
}
break;
case 'D':
case 'd': /* digits */
if (isdigit(input))
{
retval = 1;
}
break;
default:
Debug(1, "MatchClass: unknown class %c\n", class);
return (0);
break;
}
if (isupper(class))
{
return (!retval);
}
return (retval);
}
char *
PolyStrchr(string, class)
register char *string;
register char class;
{
while (*string)
{
if (MatchClass(class, *string))
{
return (string);
}
string++;
}
return ((char *) 0);
}
char *
PolySubst(string, class, new) /* returns pointer to a swapped about copy */
register char *string;
register char class;
register char new;
{
register char *ptr;
static char area[STRINGSIZE];
ptr = area;
while (*string)
{
*(ptr++) = (MatchClass(class, *string) ? new : *string);
string++;
}
*ptr = '\0';
return (area);
}
char *
PolyPurge(string, class) /* returns pointer to a purged copy */
register char *string;
register char class;
{
register char *ptr;
static char area[STRINGSIZE];
ptr = area;
while (*string)
{
if (!MatchClass(class, *string))
{
*(ptr++) = *string;
}
string++;
}
*ptr = '\0';
return (area);
}
/* -------- BACK TO NORMALITY -------- */
int
Char2Int(character)
char character;
{
if (isdigit(character))
{
return (character - '0');
} else if (islower(character))
{
return (character - 'a' + 10);
} else if (isupper(character))
{
return (character - 'A' + 10);
}
return (-1);
}
char *
Mangle(input, control) /* returns a pointer to a controlled Mangle */
char *input;
char *control;
{
int limit;
register char *ptr;
static char area[STRINGSIZE];
char area2[STRINGSIZE];
area[0] = '\0';
strcpy(area, input);
for (ptr = control; *ptr; ptr++)
{
switch (*ptr)
{
case RULE_NOOP:
break;
case RULE_REVERSE:
strcpy(area, Reverse(area));
break;
case RULE_UPPERCASE:
strcpy(area, Uppercase(area));
break;
case RULE_LOWERCASE:
strcpy(area, Lowercase(area));
break;
case RULE_CAPITALISE:
strcpy(area, Capitalise(area));
break;
case RULE_PLURALISE:
strcpy(area, Pluralise(area));
break;
case RULE_REFLECT:
strcat(area, Reverse(area));
break;
case RULE_DUPLICATE:
strcpy(area2, area);
strcat(area, area2);
break;
case RULE_GT:
if (!ptr[1])
{
Debug(1, "Mangle: '>' missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
limit = Char2Int(*(++ptr));
if (limit < 0)
{
Debug(1, "Mangle: '>' weird argument in '%s'\n", control);
return ((char *) 0);
}
if (strlen(area) <= limit)
{
return ((char *) 0);
}
}
break;
case RULE_LT:
if (!ptr[1])
{
Debug(1, "Mangle: '<' missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
limit = Char2Int(*(++ptr));
if (limit < 0)
{
Debug(1, "Mangle: '<' weird argument in '%s'\n", control);
return ((char *) 0);
}
if (strlen(area) >= limit)
{
return ((char *) 0);
}
}
break;
case RULE_PREPEND:
if (!ptr[1])
{
Debug(1, "Mangle: prepend missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
area2[0] = *(++ptr);
strcpy(area2 + 1, area);
strcpy(area, area2);
}
break;
case RULE_APPEND:
if (!ptr[1])
{
Debug(1, "Mangle: append missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
register char *string;
string = area;
while (*(string++));
string[-1] = *(++ptr);
*string = '\0';
}
break;
case RULE_EXTRACT:
if (!ptr[1] || !ptr[2])
{
Debug(1, "Mangle: extract missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
register int i;
int start;
int length;
start = Char2Int(*(++ptr));
length = Char2Int(*(++ptr));
if (start < 0 || length < 0)
{
Debug(1, "Mangle: extract: weird argument in '%s'\n", control);
return ((char *) 0);
}
strcpy(area2, area);
for (i = 0; length-- && area2[start + i]; i++)
{
area[i] = area2[start + i];
}
/* cant use strncpy() - no trailing NUL */
area[i] = '\0';
}
break;
case RULE_OVERSTRIKE:
if (!ptr[1] || !ptr[2])
{
Debug(1, "Mangle: overstrike missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
register int i;
i = Char2Int(*(++ptr));
if (i < 0)
{
Debug(1, "Mangle: overstrike weird argument in '%s'\n",
control);
return ((char *) 0);
} else
{
++ptr;
if (area[i])
{
area[i] = *ptr;
}
}
}
break;
case RULE_INSERT:
if (!ptr[1] || !ptr[2])
{
Debug(1, "Mangle: insert missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
register int i;
register char *p1;
register char *p2;
i = Char2Int(*(++ptr));
if (i < 0)
{
Debug(1, "Mangle: insert weird argument in '%s'\n",
control);
return ((char *) 0);
}
p1 = area;
p2 = area2;
while (i && *p1)
{
i--;
*(p2++) = *(p1++);
}
*(p2++) = *(++ptr);
strcpy(p2, p1);
strcpy(area, area2);
}
break;
/* THE FOLLOWING RULES REQUIRE CLASS MATCHING */
case RULE_PURGE: /* @x or @?c */
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
{
Debug(1, "Mangle: delete missing arguments in '%s'\n", control);
return ((char *) 0);
} else if (ptr[1] != RULE_CLASS)
{
strcpy(area, Purge(area, *(++ptr)));
} else
{
strcpy(area, PolyPurge(area, ptr[2]));
ptr += 2;
}
break;
case RULE_SUBSTITUTE: /* sxy || s?cy */
if (!ptr[1] || !ptr[2] || (ptr[1] == RULE_CLASS && !ptr[3]))
{
Debug(1, "Mangle: subst missing argument in '%s'\n", control);
return ((char *) 0);
} else if (ptr[1] != RULE_CLASS)
{
strcpy(area, Substitute(area, ptr[1], ptr[2]));
ptr += 2;
} else
{
strcpy(area, PolySubst(area, ptr[2], ptr[3]));
ptr += 3;
}
break;
case RULE_MATCH: /* /x || /?c */
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
{
Debug(1, "Mangle: '/' missing argument in '%s'\n", control);
return ((char *) 0);
} else if (ptr[1] != RULE_CLASS)
{
if (!strchr(area, *(++ptr)))
{
return ((char *) 0);
}
} else
{
if (!PolyStrchr(area, ptr[2]))
{
return ((char *) 0);
}
ptr += 2;
}
break;
case RULE_NOT: /* !x || !?c */
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
{
Debug(1, "Mangle: '!' missing argument in '%s'\n", control);
return ((char *) 0);
} else if (ptr[1] != RULE_CLASS)
{
if (strchr(area, *(++ptr)))
{
return ((char *) 0);
}
} else
{
if (PolyStrchr(area, ptr[2]))
{
return ((char *) 0);
}
ptr += 2;
}
break;
/*
* alternative use for a boomerang, number 1: a standard throwing
* boomerang is an ideal thing to use to tuck the sheets under
* the mattress when making your bed. The streamlined shape of
* the boomerang allows it to slip easily 'twixt mattress and
* bedframe, and it's curve makes it very easy to hook sheets
* into the gap.
*/
case RULE_EQUALS: /* =nx || =n?c */
if (!ptr[1] || !ptr[2] || (ptr[2] == RULE_CLASS && !ptr[3]))
{
Debug(1, "Mangle: '=' missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
register int i;
if ((i = Char2Int(ptr[1])) < 0)
{
Debug(1, "Mangle: '=' weird argument in '%s'\n", control);
return ((char *) 0);
}
if (ptr[2] != RULE_CLASS)
{
ptr += 2;
if (area[i] != *ptr)
{
return ((char *) 0);
}
} else
{
ptr += 3;
if (!MatchClass(*ptr, area[i]))
{
return ((char *) 0);
}
}
}
break;
case RULE_DFIRST:
if (area[0])
{
register int i;
for (i = 1; area[i]; i++)
{
area[i - 1] = area[i];
}
area[i - 1] = '\0';
}
break;
case RULE_DLAST:
if (area[0])
{
register int i;
for (i = 1; area[i]; i++);
area[i - 1] = '\0';
}
break;
case RULE_MFIRST:
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
{
Debug(1, "Mangle: '(' missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
if (ptr[1] != RULE_CLASS)
{
ptr++;
if (area[0] != *ptr)
{
return ((char *) 0);
}
} else
{
ptr += 2;
if (!MatchClass(*ptr, area[0]))
{
return ((char *) 0);
}
}
}
case RULE_MLAST:
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
{
Debug(1, "Mangle: ')' missing argument in '%s'\n", control);
return ((char *) 0);
} else
{
register int i;
for (i = 0; area[i]; i++);
if (i > 0)
{
i--;
} else
{
return ((char *) 0);
}
if (ptr[1] != RULE_CLASS)
{
ptr++;
if (area[i] != *ptr)
{
return ((char *) 0);
}
} else
{
ptr += 2;
if (!MatchClass(*ptr, area[i]))
{
return ((char *) 0);
}
}
}
default:
Debug(1, "Mangle: unknown command %c in %s\n", *ptr, control);
return ((char *) 0);
break;
}
}
if (!area[0]) /* have we deweted de poor widdle fing away? */
{
return ((char *) 0);
}
return (area);
}
int
PMatch(control, string)
register char *control;
register char *string;
{
while (*string && *control)
{
if (!MatchClass(*control, *string))
{
return(0);
}
string++;
control++;
}
if (*string || *control)
{
return(0);
}
return(1);
}

View file

@ -0,0 +1,52 @@
/*
* This program is copyright Alec Muffett 1993. The author disclaims all
* responsibility or liability with respect to it's usage or its effect
* upon hardware or computer systems, and maintains copyright as set out
* in the "LICENCE" document which accompanies distributions of Crack v4.0
* and upwards.
*/
#include "packer.h"
static char vers_id[] = "stringlib.c : v2.3p2 Alec Muffett 18 May 1993";
char
Chop(register char *string)
{
register char c;
register char *ptr;
c = '\0';
for (ptr = string; *ptr; ptr++);
if (ptr != string)
{
c = *(--ptr);
*ptr = '\0';
}
return (c);
}
char *
Trim(register char *string)
{
register char *ptr;
for (ptr = string; *ptr; ptr++);
while ((--ptr >= string) && isspace(*ptr));
*(++ptr) = '\0';
return (ptr);
}
char *
Clone (char *string)
{
register char *retval;
retval = (char *) malloc(strlen(string) + 1);
if (retval)
{
strcpy(retval, string);
}
return (retval);
}

View file

@ -0,0 +1,470 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* eel-alert-dialog.c: An HIG compliant alert dialog.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "eel-alert-dialog.h"
#include "eel-gtk-macros.h"
#include <glib/gi18n.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkimage.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkiconfactory.h>
#include <gtk/gtkexpander.h>
#include <string.h>
enum {
PROP_0,
PROP_ALERT_TYPE,
PROP_BUTTONS
};
struct _EelAlertDialogDetails {
GtkWidget *image;
GtkWidget *primary_label;
GtkWidget *secondary_label;
GtkWidget *details_expander;
GtkWidget *details_label;
GtkMessageType type;
};
static gpointer parent_class;
static void eel_alert_dialog_finalize (GObject *object);
static void eel_alert_dialog_class_init (EelAlertDialogClass *klass);
static void eel_alert_dialog_init (EelAlertDialog *dialog);
static void eel_alert_dialog_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void eel_alert_dialog_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void eel_alert_dialog_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void eel_alert_dialog_add_buttons (EelAlertDialog *alert_dialog,
GtkButtonsType buttons);
GType
eel_alert_dialog_get_type (void)
{
static GType dialog_type = 0;
if (!dialog_type) {
static const GTypeInfo dialog_info =
{
sizeof (EelAlertDialogClass),
NULL,
NULL,
(GClassInitFunc) eel_alert_dialog_class_init,
NULL,
NULL,
sizeof (EelAlertDialog),
0,
(GInstanceInitFunc) eel_alert_dialog_init,
};
dialog_type = g_type_register_static (GTK_TYPE_DIALOG, "EelAlertDialog",
&dialog_info, 0);
}
return dialog_type;
}
static void
eel_alert_dialog_class_init (EelAlertDialogClass *class)
{
GtkWidgetClass *widget_class;
GObjectClass *gobject_class;
widget_class = GTK_WIDGET_CLASS (class);
gobject_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
G_OBJECT_CLASS (class)->finalize = eel_alert_dialog_finalize;
widget_class->style_set = eel_alert_dialog_style_set;
gobject_class->set_property = eel_alert_dialog_set_property;
gobject_class->get_property = eel_alert_dialog_get_property;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("alert_border",
_("Image/label border"),
_("Width of border around the label and image in the alert dialog"),
0,
G_MAXINT,
5,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_ALERT_TYPE,
g_param_spec_enum ("alert_type",
_("Alert Type"),
_("The type of alert"),
GTK_TYPE_MESSAGE_TYPE,
GTK_MESSAGE_INFO,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
g_object_class_install_property (gobject_class,
PROP_BUTTONS,
g_param_spec_enum ("buttons",
_("Alert Buttons"),
_("The buttons shown in the alert dialog"),
GTK_TYPE_BUTTONS_TYPE,
GTK_BUTTONS_NONE,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}
static void
eel_alert_dialog_finalize (GObject *object)
{
EelAlertDialog *dialog;
dialog = EEL_ALERT_DIALOG (object);
g_free (dialog->details);
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
static void
eel_alert_dialog_init (EelAlertDialog *dialog)
{
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *expander;
dialog->details = g_new0 (EelAlertDialogDetails, 1);
dialog->details->primary_label = gtk_label_new (NULL);
dialog->details->secondary_label = gtk_label_new (NULL);
dialog->details->details_label = gtk_label_new (NULL);
dialog->details->image = gtk_image_new_from_stock (NULL, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (dialog->details->image), 0.5, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (dialog->details->primary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (dialog->details->primary_label), TRUE);
gtk_label_set_use_markup (GTK_LABEL (dialog->details->primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (dialog->details->primary_label), 0.0, 0.5);
gtk_label_set_line_wrap (GTK_LABEL (dialog->details->secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (dialog->details->secondary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (dialog->details->secondary_label), 0.0, 0.5);
gtk_label_set_line_wrap (GTK_LABEL (dialog->details->details_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (dialog->details->details_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (dialog->details->details_label), 0.0, 0.5);
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_box_pack_start (GTK_BOX (hbox), dialog->details->image,
FALSE, FALSE, 0);
vbox = gtk_vbox_new (FALSE, 12);
gtk_box_pack_start (GTK_BOX (hbox), vbox,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), dialog->details->primary_label,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), dialog->details->secondary_label,
FALSE, FALSE, 0);
expander = gtk_expander_new_with_mnemonic (_("Show more _details"));
dialog->details->details_expander = expander;
gtk_expander_set_spacing (GTK_EXPANDER (expander), 6);
gtk_container_add (GTK_CONTAINER (expander), dialog->details->details_label);
gtk_box_pack_start (GTK_BOX (vbox), expander,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
FALSE, FALSE, 0);
gtk_widget_show_all (hbox);
gtk_widget_hide (expander);
}
static void
setup_type (EelAlertDialog *dialog,
GtkMessageType type)
{
const gchar *stock_id = NULL;
GtkStockItem item;
switch (type) {
case GTK_MESSAGE_INFO:
stock_id = GTK_STOCK_DIALOG_INFO;
break;
case GTK_MESSAGE_QUESTION:
stock_id = GTK_STOCK_DIALOG_QUESTION;
break;
case GTK_MESSAGE_WARNING:
stock_id = GTK_STOCK_DIALOG_WARNING;
break;
case GTK_MESSAGE_ERROR:
stock_id = GTK_STOCK_DIALOG_ERROR;
break;
default:
g_warning ("Unknown GtkMessageType %d", type);
break;
}
if (stock_id == NULL) {
stock_id = GTK_STOCK_DIALOG_INFO;
}
if (gtk_stock_lookup (stock_id, &item)) {
gtk_image_set_from_stock (GTK_IMAGE (dialog->details->image), stock_id,
GTK_ICON_SIZE_DIALOG);
} else {
g_warning ("Stock dialog ID doesn't exist?");
}
}
static void
eel_alert_dialog_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EelAlertDialog *dialog;
dialog = EEL_ALERT_DIALOG (object);
switch (prop_id) {
case PROP_ALERT_TYPE:
dialog->details->type = g_value_get_enum (value);
setup_type (dialog, dialog->details->type);
break;
case PROP_BUTTONS:
eel_alert_dialog_add_buttons (dialog, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
eel_alert_dialog_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EelAlertDialog *dialog;
dialog = EEL_ALERT_DIALOG (object);
switch (prop_id) {
case PROP_ALERT_TYPE:
g_value_set_enum (value, dialog->details->type);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
void
eel_alert_dialog_set_primary_label (EelAlertDialog *dialog,
const gchar *message)
{
gchar *markup_str;
char *escaped_message;
if (message != NULL) {
escaped_message = g_markup_escape_text (message, -1);
markup_str = g_strconcat ("<span weight=\"bold\" size=\"larger\">", escaped_message, "</span>", NULL);
gtk_label_set_markup (GTK_LABEL (EEL_ALERT_DIALOG (dialog)->details->primary_label),
markup_str);
g_free (markup_str);
g_free (escaped_message);
}
}
void
eel_alert_dialog_set_secondary_label (EelAlertDialog *dialog,
const gchar *message)
{
if (message != NULL) {
gtk_label_set_text (GTK_LABEL (EEL_ALERT_DIALOG (dialog)->details->secondary_label),
message);
} else {
gtk_widget_hide (EEL_ALERT_DIALOG (dialog)->details->secondary_label);
}
}
void
eel_alert_dialog_set_details_label (EelAlertDialog *dialog,
const gchar *message)
{
if (message != NULL) {
gtk_widget_show (dialog->details->details_expander);
gtk_label_set_text (GTK_LABEL (dialog->details->details_label), message);
} else {
gtk_widget_hide (dialog->details->details_expander);
}
}
GtkWidget*
eel_alert_dialog_new (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
GtkButtonsType buttons,
const gchar *primary_message,
const gchar *secondary_message,
const gchar *title)
{
GtkWidget *widget;
GtkDialog *dialog;
g_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), NULL);
widget = g_object_new (EEL_TYPE_ALERT_DIALOG,
"alert_type", type,
"buttons", buttons,
NULL);
atk_object_set_role (gtk_widget_get_accessible (widget), ATK_ROLE_ALERT);
dialog = GTK_DIALOG (widget);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_dialog_set_has_separator (dialog, FALSE);
gtk_window_set_title (GTK_WINDOW (dialog),
(title != NULL) ? title : "");
eel_alert_dialog_set_primary_label (EEL_ALERT_DIALOG (dialog),
primary_message);
eel_alert_dialog_set_secondary_label (EEL_ALERT_DIALOG (dialog),
secondary_message);
if (parent != NULL) {
gtk_window_set_transient_for (GTK_WINDOW (widget),
GTK_WINDOW (parent));
}
if (flags & GTK_DIALOG_MODAL) {
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
}
if (flags & GTK_DIALOG_DESTROY_WITH_PARENT) {
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
}
return widget;
}
static void
eel_alert_dialog_add_buttons (EelAlertDialog* alert_dialog,
GtkButtonsType buttons)
{
GtkDialog* dialog;
dialog = GTK_DIALOG (alert_dialog);
switch (buttons) {
case GTK_BUTTONS_NONE:
break;
case GTK_BUTTONS_OK:
gtk_dialog_add_button (dialog,
GTK_STOCK_OK,
GTK_RESPONSE_OK);
gtk_dialog_set_default_response (dialog,
GTK_RESPONSE_OK);
break;
case GTK_BUTTONS_CLOSE:
gtk_dialog_add_button (dialog,
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE);
gtk_dialog_set_default_response (dialog,
GTK_RESPONSE_CLOSE);
break;
case GTK_BUTTONS_CANCEL:
gtk_dialog_add_button (dialog,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
gtk_dialog_set_default_response (dialog,
GTK_RESPONSE_CANCEL);
break;
case GTK_BUTTONS_YES_NO:
gtk_dialog_add_button (dialog,
GTK_STOCK_NO,
GTK_RESPONSE_NO);
gtk_dialog_add_button (dialog,
GTK_STOCK_YES,
GTK_RESPONSE_YES);
gtk_dialog_set_default_response (dialog,
GTK_RESPONSE_YES);
break;
case GTK_BUTTONS_OK_CANCEL:
gtk_dialog_add_button (dialog,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (dialog,
GTK_STOCK_OK,
GTK_RESPONSE_OK);
gtk_dialog_set_default_response (dialog,
GTK_RESPONSE_OK);
break;
default:
g_warning ("Unknown GtkButtonsType");
break;
}
g_object_notify (G_OBJECT (alert_dialog), "buttons");
}
static void
eel_alert_dialog_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
GtkWidget *parent;
gint border_width;
border_width = 0;
parent = GTK_WIDGET (EEL_ALERT_DIALOG (widget)->details->image->parent);
if (parent != NULL) {
gtk_widget_style_get (widget, "alert_border",
&border_width, NULL);
gtk_container_set_border_width (GTK_CONTAINER (parent),
border_width);
}
if (GTK_WIDGET_CLASS (parent_class)->style_set) {
(GTK_WIDGET_CLASS (parent_class)->style_set) (widget, prev_style);
}
}

View file

@ -0,0 +1,61 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* eel-alert-dialog.h: An HIG compliant alert dialog.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef EEL_ALERT_DIALOG_H
#define EEL_ALERT_DIALOG_H
#include <gtk/gtkmessagedialog.h>
#define EEL_TYPE_ALERT_DIALOG (eel_alert_dialog_get_type ())
#define EEL_ALERT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_ALERT_DIALOG, EelAlertDialog))
typedef struct _EelAlertDialog EelAlertDialog;
typedef struct _EelAlertDialogClass EelAlertDialogClass;
typedef struct _EelAlertDialogDetails EelAlertDialogDetails;
struct _EelAlertDialog
{
GtkDialog parent_instance;
EelAlertDialogDetails *details;
};
struct _EelAlertDialogClass
{
GtkDialogClass parent_class;
};
GType eel_alert_dialog_get_type (void);
GtkWidget* eel_alert_dialog_new (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
GtkButtonsType buttons,
const gchar *primary_message,
const gchar *secondary_message,
const gchar *title);
void eel_alert_dialog_set_primary_label (EelAlertDialog *dialog,
const gchar *message);
void eel_alert_dialog_set_secondary_label (EelAlertDialog *dialog,
const gchar *message);
void eel_alert_dialog_set_details_label (EelAlertDialog *dialog,
const gchar *message);
#endif /* EEL_ALERT_DIALOG_H */

View file

@ -0,0 +1,178 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
eel-gtk-macros.h: Macros to reduce boilerplate when using GTK.
Copyright (C) 1999, 2000, 2001 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Darin Adler <darin@bentspoon.com>
Ramiro Estrugo <ramiro@eazel.com>
*/
#ifndef EEL_GTK_MACROS_H
#define EEL_GTK_MACROS_H
#ifndef EEL_DISABLE_DEPRECATED
/* Define a parent_class global and a get_type function for a GTK class.
Since this is boilerplate, it's better not to repeat it over and over again.
Called like this:
EEL_CLASS_BOILERPLATE (EelBookmark, eel_bookmark, GTK_TYPE_OBJECT)
The parent_class_type parameter is guaranteed to be evaluated only once
so it can be an expression, even an expression that contains a function call.
*/
#define EEL_CLASS_BOILERPLATE(class_name, prefix, parent_class_type) \
EEL_BOILERPLATE (class_name, class_name, prefix, parent_class_type, \
EEL_REGISTER_TYPE)
#define EEL_REGISTER_TYPE(class_name, corba_name) \
g_type_register_static (parent_type, #class_name, &info, 0)
#define EEL_BOILERPLATE(class_name, corba_name, prefix, parent_class_type, \
register_type) \
\
static gpointer parent_class; \
\
GtkType \
prefix##_get_type (void) \
{ \
GtkType parent_type; \
static GtkType type; \
\
if (type == 0) { \
static GTypeInfo info = { \
sizeof (class_name##Class), \
NULL, NULL, \
(GClassInitFunc) prefix##_class_init, \
NULL, NULL, \
sizeof (class_name), 0, \
(GInstanceInitFunc) prefix##_init, \
NULL \
}; \
\
parent_type = (parent_class_type); \
type = register_type (class_name, corba_name); \
parent_class = g_type_class_ref (parent_type); \
} \
\
return type; \
}
/* Call a parent class version of a virtual function (or default
* signal handler since that's the same thing). Nice because it
* documents what it's doing and there is less chance for a
* typo. Depends on the parent class pointer having the conventional
* name "parent_class" as the boilerplate macro above does it.
*/
#define EEL_CALL_PARENT(parent_class_cast_macro, signal, parameters) \
\
G_STMT_START { \
if (parent_class_cast_macro (parent_class)->signal != NULL) { \
(* parent_class_cast_macro (parent_class)->signal) parameters;\
} \
} G_STMT_END
/* Same thing, for functions with a return value. */
#define EEL_CALL_PARENT_WITH_RETURN_VALUE(parent_class_cast_macro, signal, \
parameters) \
\
(parent_class_cast_macro (parent_class)->signal == NULL) \
? 0 \
: ((* parent_class_cast_macro (parent_class)->signal) parameters)
#endif /* EEL_DISABLE_DEPRECATED */
/* Call a virtual function. Useful when the virtual function is not a
* signal, otherwise you want to gtk_signal emit. Nice because it
* documents what it's doing and there is less chance for a typo.
*/
#define EEL_CALL_METHOD(class_cast_macro, object, signal, parameters) \
\
G_STMT_START { \
if (class_cast_macro (G_OBJECT_GET_CLASS (object))->signal != NULL) { \
(* class_cast_macro (G_OBJECT_GET_CLASS (object))->signal) \
parameters; \
} \
} G_STMT_END
/* Same thing, for functions with a return value. */
#define EEL_CALL_METHOD_WITH_RETURN_VALUE(class_cast_macro, object, signal, \
parameters) \
\
(class_cast_macro (G_OBJECT_GET_CLASS (object))->signal == NULL) \
? 0 \
: ((* class_cast_macro (G_OBJECT_GET_CLASS (object))->signal) \
parameters) \
#ifndef G_DISABLE_ASSERT
/* Define a signal that is not implemented by this class but must be
* implemented by subclasses. This macro should be used inside the
* class initialization function. The companion macro EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL
* must be used earlier in the file. Called like this:
*
* EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass,
* fm_directory_view,
* clear);
*/
#define EEL_ASSIGN_MUST_OVERRIDE_SIGNAL(class_pointer, prefix, signal) \
\
* (void (**)(void)) & (class_pointer)->signal = prefix##_unimplemented_##signal
/* Provide a debug-only implementation of a signal that must be implemented
* by subclasses. The debug-only implementation fires a warning if it is called.
* This macro should be placed as if it were a function, earlier in the file
* than the class initialization function. Called like this:
*
* EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, clear);
*/
#define EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL(prefix, signal) \
\
static void \
prefix##_unimplemented_##signal (void) \
{ \
g_warning ("failed to override signal " #prefix "->" #signal); \
}
#else /* G_DISABLE_ASSERT */
#define EEL_DEFINE_MUST_OVERRIDE_SIGNAL(class_cast_macro, class_pointer, prefix, signal)
#define EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL(prefix, signal)
#define EEL_ASSIGN_MUST_OVERRIDE_SIGNAL(class_pointer, prefix, signal)
#endif /* G_DISABLE_ASSERT */
/* Access a method. */
#define EEL_ACCESS_METHOD(class_cast_macro, object, method) \
(class_cast_macro (G_OBJECT_GET_CLASS (object))->method)
/* Invoke a method for a given object. */
#define EEL_INVOKE_METHOD(class_cast_macro, object, method, parameters) \
((* EEL_ACCESS_METHOD (class_cast_macro, object, method)) parameters)
/* Assert the non-nullness of a method for a given object. */
#define EEL_ASSERT_METHOD(class_cast_macro, object, method) \
g_assert (EEL_ACCESS_METHOD (class_cast_macro, object, method) != NULL)
/* Invoke a method if it ain't null. */
#define EEL_INVOKE_METHOD_IF(class_cast_macro, object, method, parameters) \
(EEL_ACCESS_METHOD (class_cast_macro, object, method) ? 0 : \
EEL_INVOKE_METHOD (class_cast_macro, object, method, parameters))
#endif /* EEL_GTK_MACROS_H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -27,27 +27,41 @@
#include <gnome.h>
#include <pwd.h>
#include <stdlib.h>
#include <glade/glade.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <sys/poll.h>
#include <termios.h>
#include <pty.h>
#include <crack.h>
#include "capplet-util.h"
#include "eel-alert-dialog.h"
typedef struct {
GtkWidget *dialog;
GladeXML *xml;
GtkWidget *old_password;
GtkWidget *new_password;
GtkWidget *retyped_password;
/* Communication with the passwd program */
FILE *backend_stream;
int backend_master_fd;
int backend_pid;
guint timeout_id;
guint check_password_timeout_id;
gboolean good_password;
/* Communication with the passwd program */
int backend_pid;
int write_fd;
int read_fd;
FILE *write_stream;
FILE *read_stream;
} PasswordDialog;
enum
@ -63,57 +77,62 @@ static void passdlg_set_busy (PasswordDialog *dlg, gboolean busy);
static gboolean
wait_child (PasswordDialog *pdialog)
{
GtkWidget *dialog;
gint status, pid;
gchar *primary_text = NULL;
gchar *secondary_text = NULL;
gchar *msg, *details, *title;
GladeXML *dialog;
GtkWidget *wmessage, *wbulb;
GtkWidget *wedialog;
dialog = pdialog->xml;
wmessage = WID ("message");
wbulb = WID ("bulb");
pid = waitpid (pdialog->backend_pid, &status, WNOHANG);
passdlg_set_busy (pdialog, FALSE);
if (pid > 0) {
if (WIFEXITED (status) && (WEXITSTATUS(status) == 0)) {
passdlg_set_busy (pdialog, FALSE);
primary_text = g_strdup (_("Password changed successfully"));
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
primary_text, secondary_text);
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_widget_show (dialog);
gtk_main_quit ();
return FALSE;
} else if ((WIFEXITED (status)) && (WEXITSTATUS (status)) && (WEXITSTATUS(status) < 255)) {
/* the proccess was running su */
primary_text = g_strdup (_("The entered password is invalid"));
secondary_text = g_strdup (_("Check that you typed it correctly "
"and that you haven't activated the \"caps lock\" key"));
msg = g_strdup (_("<b>Old password is incorret, please retype it</b>"));
gtk_label_set_markup (GTK_LABEL (wmessage), msg);
g_free (msg);
gtk_image_set_from_file (GTK_IMAGE (wbulb),
GNOMECC_DATA_DIR "/pixmaps/gnome-about-me-bulb-off.png");
return FALSE;
} else if ((WIFEXITED (status)) && (WEXITSTATUS (status)) && (WEXITSTATUS (status) == 255)) {
primary_text = g_strdup (_("Could not run passwd"));
secondary_text = g_strdup (_("Check that you have permissions to run this command"));
msg = g_strdup (_("Symtem error has ocurred"));
details = g_strdup (_("Could not run /usr/bin/passwd"));
title = g_strdup (_("Unable to launch backend"));
} else {
primary_text = g_strdup (_("An unexpected error has ocurred"));
msg = g_strdup (_("Unexpected error has ocurred"));
title = g_strdup (_("Unexpected error has ocurred"));
details = NULL;
}
if (primary_text) {
passdlg_set_busy (pdialog, FALSE);
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
primary_text, secondary_text);
wedialog = eel_alert_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
msg, NULL, title);
g_signal_connect (G_OBJECT (dialog), "response",
if (details != NULL)
eel_alert_dialog_set_details_label (EEL_ALERT_DIALOG (wedialog), details);
g_signal_connect (G_OBJECT (wedialog), "response",
G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_widget_show (dialog);
g_free (primary_text);
g_free (secondary_text);
}
gtk_window_set_resizable (GTK_WINDOW (wedialog), FALSE);
gtk_widget_show (wedialog);
g_free (msg);
g_free (title);
g_free (details);
return FALSE;
}
@ -130,57 +149,59 @@ is_string_complete (gchar *str, GSList *list)
return FALSE;
for (elem = list; elem; elem = g_slist_next (elem))
if (g_strrstr (str, elem->data) != NULL)
if (g_strrstr (str, elem->data) != NULL) {
return TRUE;
}
return FALSE;
}
static gchar*
read_everything (PasswordDialog *pdialog, gchar *needle, va_list ap)
{
GString *str = g_string_new ("");
GSList *list = NULL;
gchar*arg, *ptr, c;
list = g_slist_prepend (list, needle);
while ((arg = va_arg (ap, char*)) != NULL)
list = g_slist_prepend (list, arg);
va_end (ap);
while (!is_string_complete (str->str, list)) {
c = fgetc (pdialog->read_stream);
if (c != EOF)
g_string_append_c (str, c);
}
ptr = str->str;
g_string_free (str, FALSE);
return ptr;
}
static void
poll_backend (PasswordDialog *pdialog)
{
struct pollfd fd;
fd.fd = pdialog->read_fd;
fd.events = POLLIN || POLLPRI;
while (poll (&fd, 1, 100) <= 0) {
while (gtk_events_pending ())
gtk_main_iteration ();
}
}
static char *
read_from_backend_va (PasswordDialog *pdialog, gchar *needle, va_list ap)
{
GString *str = g_string_new ("");
gboolean may_exit = FALSE;
gint i = 0;
gchar c, *ptr, *arg;
GSList *list = NULL;
list = g_slist_prepend (list, needle);
while ((arg = va_arg (ap, char*)) != NULL)
list = g_slist_prepend (list, arg);
va_end (ap);
while (!is_string_complete (str->str, list)) {
c = fgetc (pdialog->backend_stream);
i++;
if (*str->str)
g_string_append_c (str, c);
else {
/* the string is still empty, read with O_NONBLOCK until
* it gets a char, this is done for not blocking the UI
*/
if (c != EOF) {
g_string_append_c (str, c);
fcntl (pdialog->backend_master_fd, F_SETFL, 0);
}
usleep (500);
}
/* ugly hack for redrawing UI without too much overload */
if (i == REDRAW_NCHARS) {
while (gtk_events_pending ())
gtk_main_iteration ();
i = 0;
}
}
fcntl (pdialog->backend_master_fd, F_SETFL, O_NONBLOCK);
ptr = str->str;
g_string_free (str, FALSE);
return ptr;
poll_backend (pdialog);
return read_everything (pdialog, needle, ap);
}
static gchar*
@ -198,11 +219,10 @@ write_to_backend (PasswordDialog *pdialog, char *str)
gint nread = 0;
int ret;
/* turn the descriptor blocking for writing the configuration */
fcntl (pdialog->backend_master_fd, F_SETFL, 0);
do {
ret = fputc (str [nread], pdialog->backend_stream);
ret = fputc (str [nread], pdialog->write_stream);
usleep (1000);
if (ret != EOF)
nread++;
@ -213,23 +233,25 @@ write_to_backend (PasswordDialog *pdialog, char *str)
gtk_main_iteration ();
} while (nread < strlen (str));
while (fflush (pdialog->backend_stream) != 0);
fcntl (pdialog->backend_master_fd, F_SETFL, O_NONBLOCK);
while (fflush (pdialog->write_stream) != 0);
}
static void
passdlg_set_busy (PasswordDialog *pdialog, gboolean busy)
{
GtkWindow *toplevel = GTK_WINDOW (pdialog->dialog);
GladeXML *dialog;
GtkWidget *toplevel;
GdkCursor *cursor = NULL;
GdkDisplay *display;
display = gtk_widget_get_display (GTK_WIDGET (toplevel));
dialog = pdialog->xml;
toplevel = WID ("change-password");
display = gtk_widget_get_display (toplevel);
if (busy)
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
gdk_window_set_cursor (GTK_WIDGET (toplevel)->window, cursor);
gdk_window_set_cursor (toplevel->window, cursor);
gdk_display_flush (display);
if (busy)
@ -237,97 +259,263 @@ passdlg_set_busy (PasswordDialog *pdialog, gboolean busy)
}
static void
passdlg_button_clicked_cb (GtkDialog *dialog, gint response_id, PasswordDialog *pdialog)
static gint
update_password (PasswordDialog *pdialog)
{
GtkWidget *wopasswd, *wnpasswd, *wrnpasswd;
char *new_password;
char *retyped_password;
char *old_password;
char *args[2];
gchar *s;
GladeXML *dialog;
dialog = pdialog->xml;
wopasswd = WID ("old-password");
wnpasswd = WID ("new-password");
wrnpasswd = WID ("retyped-password");
/* */
old_password = g_strdup_printf ("%s\n", gtk_entry_get_text (GTK_ENTRY (wopasswd)));
new_password = g_strdup_printf ("%s\n", gtk_entry_get_text (GTK_ENTRY (wnpasswd)));
retyped_password = g_strdup_printf ("%s\n", gtk_entry_get_text (GTK_ENTRY (wrnpasswd)));
/* Set the busy cursor as this can be a long process */
passdlg_set_busy (pdialog, TRUE);
s = read_from_backend (pdialog, "assword: ", NULL);
g_free (s);
write_to_backend (pdialog, old_password);
/* New password */
s = read_from_backend (pdialog, "assword: ", "failure", NULL);
if (g_strrstr (s, "failure") != NULL) {
g_free (s);
return -1;
}
g_free (s);
write_to_backend (pdialog, new_password);
/* Retype password */
s = read_from_backend (pdialog, "assword: ", NULL);
g_free (s);
write_to_backend (pdialog, retyped_password);
s = read_from_backend (pdialog, "successfully", "Bad:", "recovered", NULL);
if (g_strrstr (s, "recovered") != NULL) {
return -2;
} else if (g_strrstr (s, "Bad") != NULL) {
return -3;
}
return 0;
}
static void
spawn_passwd (PasswordDialog *pdialog)
{
char *args[2];
int p[2];
/* Prepare the execution environment of passwd */
args[0] = "/usr/bin/passwd";
args[1] = NULL;
pipe (p);
pdialog->backend_pid = forkpty (&pdialog->write_fd, NULL, NULL, NULL);
if (pdialog->backend_pid < 0) {
g_warning ("could not fork to backend");
gtk_main_quit ();
} else if (pdialog->backend_pid == 0) {
dup2 (p[1], 1);
dup2 (p[1], 2);
close (p[0]);
unsetenv("LC_ALL");
unsetenv("LC_MESSAGES");
unsetenv("LANG");
unsetenv("LANGUAGE");
execv (args[0], args);
exit (255);
} else {
close (p[1]);
pdialog->read_fd = p[0];
pdialog->timeout_id = g_timeout_add (4000, (GSourceFunc) wait_child, pdialog);
pdialog->read_stream = fdopen (pdialog->read_fd, "r");;
pdialog->write_stream = fdopen (pdialog->write_fd, "w");
setvbuf (pdialog->read_stream, NULL, _IONBF, 0);
fcntl (pdialog->read_fd, F_SETFL, 0);
}
}
static void
passdlg_button_clicked_cb (GtkDialog *widget, gint response_id, PasswordDialog *pdialog)
{
GladeXML *dialog;
GtkWidget *wmessage, *wbulb;
gchar *msg;
gint ret;
dialog = pdialog->xml;
wmessage = WID ("message");
wbulb = WID ("bulb");
if (response_id == GTK_RESPONSE_OK) {
/* */
old_password = g_strdup_printf ("%s\n", gtk_entry_get_text (GTK_ENTRY (pdialog->old_password)));
new_password = g_strdup_printf ("%s\n", gtk_entry_get_text (GTK_ENTRY (pdialog->new_password)));
retyped_password = g_strdup_printf ("%s\n", gtk_entry_get_text (GTK_ENTRY (pdialog->retyped_password)));
spawn_passwd (pdialog);
/* Set the busy cursor as this can be a long process */
passdlg_set_busy (pdialog, TRUE);
ret = update_password (pdialog);
passdlg_set_busy (pdialog, FALSE);
/* Prepare the execution environment of passwd */
args[0] = "/usr/bin/passwd";
args[1] = NULL;
/* No longer need the wait_child fallback, remove the timeout */
g_source_remove (pdialog->timeout_id);
pdialog->backend_pid = forkpty (&pdialog->backend_master_fd, NULL, NULL, NULL);
if (pdialog->backend_pid < 0) {
g_warning ("could not fork to backend");
if (ret == -1) {
msg = g_strdup (_("<b>Old password is incorret, please retype it</b>"));
gtk_label_set_markup (GTK_LABEL (wmessage), msg);
g_free (msg);
gtk_image_set_from_file (GTK_IMAGE (wbulb),
GNOMECC_DATA_DIR "/pixmaps/gnome-about-me-bulb-off.png");
}
/* This is the standard way of returning from the dialog with passwd
* If we return this way we can safely kill passwd as it has completed
* its task. In case of problems we still have the wait_child fallback
*/
fclose (pdialog->write_stream);
fclose (pdialog->read_stream);
close (pdialog->read_fd);
close (pdialog->write_fd);
kill (pdialog->backend_pid, 9);
if (ret == 0)
gtk_main_quit ();
} else if (pdialog->backend_pid == 0) {
execv (args[0], args);
exit (255);
} else {
fcntl (pdialog->backend_master_fd, F_SETFL, O_NONBLOCK);
pdialog->timeout_id = g_timeout_add (1000, (GSourceFunc) wait_child, pdialog);
pdialog->backend_stream = fdopen (pdialog->backend_master_fd, "a+");
}
/* Send current password to backend */
s = read_from_backend (pdialog, "assword:", ": ", NULL);
write_to_backend (pdialog, old_password);
s = read_from_backend (pdialog, "assword:", ": ", "\n", NULL);
while (strlen(s) < 4) {
usleep(1000);
s = read_from_backend (pdialog, "assword:", ": ", "\n", NULL);
}
/* Send new password to backend */
write_to_backend (pdialog, new_password);
s = read_from_backend (pdialog, "assword:", ": ", "\n", NULL);
while (strlen(s) < 4) {
usleep(1000);
s = read_from_backend (pdialog, "assword:", ": ", "\n", NULL);
}
/* Send new and retyped password to backend */
write_to_backend (pdialog, retyped_password);
s = read_from_backend (pdialog, "assword:", ": ", "\n", NULL);
while (strlen(s) < 4) {
usleep(1000);
s = read_from_backend (pdialog, "\n", NULL);
}
} else {
gtk_main_quit ();
}
}
static gboolean
passdlg_check_password_timeout_cb (PasswordDialog *pdialog)
{
const gchar *password;
const gchar *retyped_password;
char *msg, *msgtmp;
gboolean good_password;
GtkWidget *wbulb, *wok, *wmessage;
GtkWidget *wnpassword, *wrnpassword;
GladeXML *dialog;
dialog = pdialog->xml;
wnpassword = WID ("new-password");
wrnpassword = WID ("retyped-password");
wmessage = WID ("message");
wbulb = WID ("bulb");
wok = WID ("ok");
password = gtk_entry_get_text (GTK_ENTRY (wnpassword));
retyped_password = gtk_entry_get_text (GTK_ENTRY (wrnpassword));
if (strlen (password) == 0 || strlen (retyped_password) == 0) {
gtk_image_set_from_file (GTK_IMAGE (wbulb),
GNOMECC_DATA_DIR "/pixmaps/gnome-about-me-bulb-off.png");
gtk_label_set_markup (GTK_LABEL (wmessage), NULL);
return FALSE;
}
if (strcmp (password, retyped_password) != 0) {
msg = g_strdup ("<b>Please type the password again, it is wrong.</b>");
good_password = FALSE;
} else {
msgtmp = FascistCheck (password, CRACKLIB_DICTPATH);
if (msgtmp == NULL) {
msg = g_strdup ("<b>Push on the ok button to change the password</b>");
good_password = TRUE;
} else {
msg = g_strdup_printf ("<b>%s</b>", msgtmp);
g_free (msgtmp);
good_password = FALSE;
}
}
if (good_password && pdialog->good_password == FALSE) {
gtk_image_set_from_file (GTK_IMAGE (wbulb),
GNOMECC_DATA_DIR "/pixmaps/gnome-about-me-bulb-on.png");
gtk_widget_set_sensitive (wok, TRUE);
} else if (good_password == FALSE && pdialog->good_password == TRUE) {
gtk_image_set_from_file (GTK_IMAGE (wbulb),
GNOMECC_DATA_DIR "/pixmaps/gnome-about-me-bulb-off.png");
gtk_widget_set_sensitive (wok, FALSE);
}
pdialog->good_password = good_password;
gtk_label_set_markup (GTK_LABEL (wmessage), msg);
g_free (msg);
return FALSE;
}
static void
passdlg_check_password (GtkEntry *entry, PasswordDialog *pdialog)
{
if (pdialog->check_password_timeout_id) {
g_source_remove (pdialog->check_password_timeout_id);
}
pdialog->check_password_timeout_id =
g_timeout_add (300, (GSourceFunc) passdlg_check_password_timeout_cb, pdialog);
}
void
gnome_about_me_password (void)
gnome_about_me_password (GtkWindow *parent)
{
PasswordDialog *pdialog;
GtkWidget *wpassdlg;
GladeXML *dialog;
pdialog = g_new0 (PasswordDialog, 1);
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-about-me.glade", "change-password", NULL);
pdialog->dialog = WID ("change-password");
g_signal_connect (G_OBJECT (pdialog->dialog), "response",
pdialog->xml = dialog;
wpassdlg = WID ("change-password");
g_signal_connect (G_OBJECT (wpassdlg), "response",
G_CALLBACK (passdlg_button_clicked_cb), pdialog);
pdialog->old_password = WID ("old-password");
pdialog->new_password = WID ("new-password");
pdialog->retyped_password = WID ("retyped-password");
pdialog->good_password = FALSE;
gtk_window_set_resizable (GTK_WINDOW (pdialog->dialog), FALSE);
gtk_widget_show_all (pdialog->dialog);
g_signal_connect (G_OBJECT (WID ("new-password")), "changed",
G_CALLBACK (passdlg_check_password), pdialog);
g_signal_connect (G_OBJECT (WID ("retyped-password")), "changed",
G_CALLBACK (passdlg_check_password), pdialog);
gtk_image_set_from_file (GTK_IMAGE (WID ("bulb")), GNOMECC_DATA_DIR "/pixmaps/gnome-about-me-bulb-off.png");
gtk_widget_set_sensitive (WID ("ok"), FALSE);
gtk_window_set_resizable (GTK_WINDOW (wpassdlg), FALSE);
gtk_window_set_transient_for (GTK_WINDOW (wpassdlg), GTK_WINDOW (parent));
gtk_widget_show_all (wpassdlg);
gtk_main ();
gtk_widget_destroy (pdialog->dialog);
g_object_unref (G_OBJECT (dialog));
gtk_widget_destroy (wpassdlg);
g_object_unref (G_OBJECT (wpassdlg));
g_free (pdialog);
}

View file

@ -55,6 +55,8 @@ typedef struct {
gboolean create_self;
gchar *person;
guint commit_timeout_id;
} GnomeAboutMe;
static GnomeAboutMe *me;
@ -152,6 +154,16 @@ about_me_commit (GnomeAboutMe *me)
me->create_self = FALSE;
}
static gboolean
about_me_commit_from_timeout (GnomeAboutMe *me)
{
g_print ("commit from timeout\n");
about_me_commit (me);
return FALSE;
}
static gboolean
about_me_focus_out (GtkWidget *widget, GdkEventFocus *event, GnomeAboutMe *me)
{
@ -198,8 +210,12 @@ about_me_focus_out (GtkWidget *widget, GdkEventFocus *event, GnomeAboutMe *me)
g_free (str);
about_me_commit (me);
if (me->commit_timeout_id) {
g_source_remove (me->commit_timeout_id);
}
me->commit_timeout_id = g_timeout_add (600, (GSourceFunc) about_me_commit_from_timeout, me);
return FALSE;
}
@ -391,15 +407,17 @@ about_me_update_photo (GnomeAboutMe *me)
e_contact_set (me->contact, E_CONTACT_PHOTO, photo);
/* Save the image for GDM */
file = g_strdup_printf ("%s/.gnome2/face.png", g_get_home_dir ());
file = g_strdup_printf ("%s/.face", g_get_home_dir ());
fp = fopen (file, "wb");
fwrite (photo->data, 1, photo->length, fp);
fclose (fp);
/* Update GDM configuration */
/*
gnome_config_set_string ("/gdmphotosetup/last/picture", file);
gnome_config_set_string ("/gdm/face/picture", file);
gnome_config_sync ();
*/
g_free (file);
e_contact_photo_free (photo);
@ -579,9 +597,12 @@ about_me_button_clicked_cb (GtkDialog *dialog, gint response_id, GnomeAboutMe *m
}
static void
about_me_passwd_clicked_cb (GtkWidget *button, gpointer data)
about_me_passwd_clicked_cb (GtkWidget *button, GnomeAboutMe *me)
{
gnome_about_me_password ();
GladeXML *dialog;
dialog = me->dialog;
gnome_about_me_password (WID ("about-me-dialog"));
}
static void
@ -659,11 +680,12 @@ about_me_setup_dialog (void)
about_me_load_photo (me, me->contact);
widget = WID ("fullname");
if (tok[0] == NULL || strlen(tok[0]) == 0) {
str = g_strdup ("<b><span size=\"xx-large\">COMO LO HAGO?</span></b>");
if (tok[0] == NULL || strlen (tok[0]) == 0) {
str = g_strdup_printf ("<b><span size=\"xx-large\">%s</span></b>", user);
} else {
str = g_strdup_printf ("<b><span size=\"xx-large\">%s</span></b>", tok[0]);
}
gtk_label_set_markup (GTK_LABEL (widget), str);
g_free (str);
@ -671,13 +693,17 @@ about_me_setup_dialog (void)
gtk_label_set_text (GTK_LABEL (widget), user);
widget = WID ("about-me-dialog");
str = g_strdup_printf ("About %s", tok[0]);
if (tok[0] == NULL || strlen (tok[0]) == 0) {
str = g_strdup_printf ("About %s", user);
} else {
str = g_strdup_printf ("About %s", tok[0]);
}
gtk_window_set_title (GTK_WINDOW (widget), str);
g_free (str);
widget = WID("password");
g_signal_connect (G_OBJECT (widget), "clicked",
G_CALLBACK (about_me_passwd_clicked_cb), NULL);
G_CALLBACK (about_me_passwd_clicked_cb), me);
widget = WID ("button-image");
g_signal_connect (G_OBJECT (widget), "clicked",

View file

@ -0,0 +1,15 @@
[Desktop Entry]
Encoding=UTF-8
_Name=About-me
_Comment=Set your personal information
Exec=gnome-about-me
Icon=gnome-about-me
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;Application;Settings;
OnlyShowIn=GNOME;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=control-center
X-GNOME-Bugzilla-Component=Keyboard
X-GNOME-Bugzilla-Version=@VERSION@

View file

@ -16,6 +16,7 @@
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
@ -119,9 +120,13 @@
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.48</property>
<property name="yalign">0.479999989271</property>
<property name="xpad">12</property>
<property name="ypad">12</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
@ -163,6 +168,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
@ -184,6 +193,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
@ -319,6 +332,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">email-work-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -344,6 +361,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">email-home-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -414,6 +435,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
@ -470,6 +495,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">phone-work-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -495,6 +524,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">phone-home-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -604,6 +637,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">phone-mobile-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -629,6 +666,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">phone-work-fax-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -657,6 +698,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
@ -713,6 +758,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">im-jabber-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -780,6 +829,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">im-yahoo-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -805,6 +858,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">im-msn-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -830,6 +887,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">im-icq-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -855,6 +916,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">im-aim-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -880,6 +945,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">im-groupwise-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -992,6 +1061,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
@ -1024,6 +1097,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">tab</property>
@ -1085,6 +1162,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">scrolledwindow3</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -1147,6 +1229,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-locality-1</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -1171,6 +1258,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-code-1</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -1195,6 +1287,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-region-1</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -1219,6 +1316,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-country-1</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -1243,6 +1345,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-po-1</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -1376,6 +1483,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
@ -1438,6 +1549,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">scrolledwindow4</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -1500,6 +1616,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-code-2</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -1524,6 +1645,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-region-2</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -1548,6 +1674,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-country-2</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -1572,6 +1703,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-po-2</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -1596,6 +1732,11 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">addr-locality-2</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
@ -1729,6 +1870,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
@ -1761,6 +1906,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">tab</property>
@ -1817,6 +1966,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">web-homepage-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -1842,6 +1995,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">web-weblog-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -1867,6 +2024,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">web-calendar-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -1958,6 +2119,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
@ -2014,6 +2179,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">job-profession-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -2039,6 +2208,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">job-company-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -2064,6 +2237,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">job-manager-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -2089,6 +2266,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">job-title-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -2114,6 +2295,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">job-dept-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -2139,6 +2324,10 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">job-assistant-e</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -2293,6 +2482,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
@ -2325,6 +2518,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">tab</property>
@ -2384,7 +2581,7 @@
<property name="title" translatable="yes">Change Password</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">False</property>
<property name="modal">True</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
@ -2392,7 +2589,8 @@
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_CENTER</property>
<property name="has_separator">True</property>
<property name="focus_on_map">True</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox3">
@ -2419,7 +2617,7 @@
</child>
<child>
<widget class="GtkButton" id="okbutton1">
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -2463,7 +2661,7 @@
<widget class="GtkTable" id="table104">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">4</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -2503,6 +2701,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -2548,6 +2750,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -2607,6 +2813,10 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@ -2617,6 +2827,88 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox15">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkImage" id="bulb">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="message">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">39</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment17">
<property name="border_width">7</property>
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
</packing>
</child>
</widget>
</child>
</widget>