From 64e4f38daeae9926ef7f50b24f49f4d7f8b8c971 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 31 Jan 2004 00:46:38 +0000 Subject: [PATCH] Add support for Addressless Ticket Checkbox. Applied patch from Doug Engert ticket: 982 tags: pullup target_version: 1.3.2 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15989 dc483132-0cff-0310-8789-dd5450dbe970 --- src/windows/cns/ChangeLog | 6 ++++++ src/windows/cns/cns.c | 8 ++++++-- src/windows/cns/cns.h | 2 ++ src/windows/cns/cns_reg.c | 6 +++++- src/windows/cns/cns_reg.h | 1 + src/windows/cns/cnsres5.rc | 4 +++- src/windows/cns/options.c | 6 ++++++ 7 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/windows/cns/ChangeLog b/src/windows/cns/ChangeLog index 54cfa75c4..73960c080 100644 --- a/src/windows/cns/ChangeLog +++ b/src/windows/cns/ChangeLog @@ -1,3 +1,9 @@ +2004-01-30 Jeffrey Altman + + * options.c, cnsres5.rc, cns.h, cns_reg.c cns_reg.h, cns.c: + Add checkbox for requesting "no addresses" if it is not + specified in the krb5.ini file. + 2003-02-25 Tom Yu * kpasswd.c (k5_change_password): Don't pass a NULL pointer to diff --git a/src/windows/cns/cns.c b/src/windows/cns/cns.c index 13404b736..7a02abba7 100644 --- a/src/windows/cns/cns.c +++ b/src/windows/cns/cns.c @@ -58,6 +58,7 @@ char confname[FILENAME_MAX]; /* krb5.conf (or krb.conf for krb4) */ #ifdef KRB5 char ccname[FILENAME_MAX]; /* ccache file location */ BOOL forwardable; /* TRUE to get forwardable tickets */ +BOOL noaddresses; krb5_context k5_context; krb5_ccache k5_ccache; #endif @@ -1224,7 +1225,10 @@ kwin_command(HWND hwnd, int cid, HWND hwndCtl, UINT codeNotify) krb5_get_init_creds_opt_init(&opts); krb5_get_init_creds_opt_set_forwardable(&opts, forwardable); krb5_get_init_creds_opt_set_tkt_life(&opts, lifetime * 60); - + if (noaddresses) { + krb5_get_init_creds_opt_set_address_list(&opts, NULL); + } + /* * get the initial creds using the password and the options we set above */ @@ -1491,7 +1495,6 @@ kwin_paint(HWND hwnd) LRESULT CALLBACK kwin_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - int n; #if 0 if (message == wm_kerberos_changed) { /* Message from the ccache */ @@ -1704,6 +1707,7 @@ init_instance(HINSTANCE hinstance, int ncmdshow) * ticket options */ forwardable = cns_res.forwardable; + noaddresses = cns_res.noaddresses; /* * Load clock icons diff --git a/src/windows/cns/cns.h b/src/windows/cns/cns.h index 7cc93ab9a..cdd6da3b3 100644 --- a/src/windows/cns/cns.h +++ b/src/windows/cns/cns.h @@ -144,6 +144,7 @@ #define IDD_ALERT 312 #define IDD_TKOPT 320 #define IDD_FORWARDABLE 321 +#define IDD_NOADDRESSES 322 /* * the entire range (400 through 499) is reserved for the blasted variable @@ -199,6 +200,7 @@ extern krb5_context k5_context; extern krb5_ccache k5_ccache; extern char ccname[FILENAME_MAX]; extern BOOL forwardable; +extern BOOL noaddresses; #endif /* diff --git a/src/windows/cns/cns_reg.c b/src/windows/cns/cns_reg.c index 160eb15e3..92255fe4f 100644 --- a/src/windows/cns/cns_reg.c +++ b/src/windows/cns/cns_reg.c @@ -45,7 +45,7 @@ cns_load_registry(void) cns_res.beep = 0; cns_res.lifetime = DEFAULT_TKT_LIFE * 5; cns_res.forwardable = 1; - + cns_res.noaddresses = 0; for (i = 1 ; i < FILE_MENU_MAX_LOGINS ; i++) cns_res.logins[i][0] = '\0'; @@ -117,6 +117,9 @@ cns_load_registry(void) if (registry_dword_get(key, "forwardable", &tdw) == 0) cns_res.forwardable = tdw; + if (registry_dword_get(key, "noaddresses", &tdw) == 0) + cns_res.noaddresses = tdw; + if (registry_dword_get(key, "alert", &tdw) == 0) cns_res.alert = tdw; @@ -196,6 +199,7 @@ cns_save_registry(void) registry_dword_set(key, "beep", cns_res.beep); registry_dword_set(key, "lifetime", cns_res.lifetime); registry_dword_set(key, "forwardable", cns_res.forwardable); + registry_dword_set(key, "noaddresses", cns_res.noaddresses); registry_string_set(key, "name", cns_res.name); registry_string_set(key, "realm", cns_res.realm); diff --git a/src/windows/cns/cns_reg.h b/src/windows/cns/cns_reg.h index 7ec726356..9ebed4fe8 100644 --- a/src/windows/cns/cns_reg.h +++ b/src/windows/cns/cns_reg.h @@ -17,6 +17,7 @@ typedef struct cns_reg { DWORD forwardable; /* get forwardable tickets? */ DWORD conf_override; /* allow changing of confname */ DWORD cc_override; /* allow changing of ccname */ + DWORD noaddresses; /* Don't require address in tickets */ char name[MAX_K_NAME_SZ]; /* last user used */ char realm[MAX_K_NAME_SZ]; /* last realm used */ char confname[FILENAME_MAX]; diff --git a/src/windows/cns/cnsres5.rc b/src/windows/cns/cnsres5.rc index e56375334..d398078e3 100644 --- a/src/windows/cns/cnsres5.rc +++ b/src/windows/cns/cnsres5.rc @@ -161,7 +161,9 @@ BEGIN 95,65,39,12 GROUPBOX "Ticket options",IDD_TKOPT,5,86,158,23,WS_GROUP CONTROL "&Forwardable",IDD_FORWARDABLE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,54,95,65,12 + WS_TABSTOP,25,95,65,12 + CONTROL "&NoAddresses",IDD_NOADDRESSES,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,90,95,65,12 DEFPUSHBUTTON "OK",IDOK,19,117,52,14 PUSHBUTTON "Cancel",IDCANCEL,95,117,52,14 END diff --git a/src/windows/cns/options.c b/src/windows/cns/options.c index f13314575..9e7c30e94 100644 --- a/src/windows/cns/options.c +++ b/src/windows/cns/options.c @@ -74,6 +74,9 @@ opts_initdialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) forwardable = cns_res.forwardable; SendDlgItemMessage(hwnd, IDD_FORWARDABLE, BM_SETCHECK, forwardable, 0); + noaddresses = cns_res.noaddresses; + SendDlgItemMessage(hwnd, IDD_NOADDRESSES, BM_SETCHECK, noaddresses, 0); + return TRUE; } @@ -161,6 +164,9 @@ opts_command(HWND hwnd, int cid, HWND hwndCtl, UINT codeNotify) forwardable = SendDlgItemMessage(hwnd, IDD_FORWARDABLE, BM_GETCHECK, 0, 0); cns_res.forwardable = forwardable; + noaddresses = SendDlgItemMessage(hwnd, IDD_NOADDRESSES, BM_GETCHECK, 0, 0); + cns_res.noaddresses = noaddresses; + EndDialog(hwnd, IDOK); return; /* TRUE */ -- 2.26.2