Add support for Addressless Ticket Checkbox. Applied patch from Doug Engert
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 31 Jan 2004 00:46:38 +0000 (00:46 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 31 Jan 2004 00:46:38 +0000 (00:46 +0000)
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
src/windows/cns/cns.c
src/windows/cns/cns.h
src/windows/cns/cns_reg.c
src/windows/cns/cns_reg.h
src/windows/cns/cnsres5.rc
src/windows/cns/options.c

index 54cfa75c49fe5372a478d0efd530693fe7424228..73960c0806293068880971bff1345059a4c5f7c1 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-30  Jeffrey Altman <jaltman@mit.edu>
+
+    * 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  <tlyu@mit.edu>
 
        * kpasswd.c (k5_change_password): Don't pass a NULL pointer to
index 13404b73664c9165ebc032b2946f2525b7ad68b2..7a02abba7e59e1f0cdc22cd3ef167e3451376e27 100644 (file)
@@ -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
index 7cc93ab9aee5a34df61eceaf984ec92b85f3f5ee..cdd6da3b3973a340e1daa91ea739791913463143 100644 (file)
 #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
 
 /*
index 160eb15e3fc9dd3b38487d9e513faa8731f19456..92255fe4f5494878cbe97f26e23d368286dc7a94 100644 (file)
@@ -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);
index 7ec726356966f748239d7c64fc5264a3398ee627..9ebed4fe858d6e4b1069e01e6f32b4d88c269288 100644 (file)
@@ -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];
index e56375334b8299be8857da3c235122cc20db1e6d..d398078e3972b761758a66e75ff69954e6f8dc2a 100644 (file)
@@ -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
index f133145754c3cc1bca5a8f4dcb6b4f310f74e16c..9e7c30e94e2f0e65975ccb0bffabf5558adcebc1 100644 (file)
@@ -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 */