Skip to content

Commit

Permalink
Fixed List Display Of PKCS Certs In Pageant
Browse files Browse the repository at this point in the history
- Adjusted key/cert list within Pageant to properly display PKCS certs
- Updated system tray menu options to match list dialog buttons
- Removed unused macros
  • Loading branch information
NoMoreFood committed May 18, 2017
1 parent 5d7fcf6 commit 9f028fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
5 changes: 0 additions & 5 deletions cert/cert_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,8 @@ EXTERN LPBYTE cert_get_hash(LPCSTR szAlgo, LPCBYTE pDataToHash, DWORD iDataToHas
#define IDEN_TYPE(p) (cert_is_capipath(p) ? "CAPI" : "PKCS")

#define cert_is_capipath(p) (strnicmp((LPSTR) p, IDEN_CAPI, IDEN_CAPI_SIZE) == 0)
#define cert_is_capipath_len(p,l) ((l) >= IDEN_CAPI_SIZE && cert_is_capipath(p))

#define cert_is_pkcspath(p) (strnicmp((LPSTR) p, IDEN_PKCS, IDEN_PKCS_SIZE) == 0)
#define cert_is_pkcspath_len(p,l) ((l) >= IDEN_PKCS_SIZE && cert_is_pkcspath(p))

#define cert_is_certpath(p) (p != NULL && (cert_is_capipath(p) || cert_is_pkcspath(p)))
#define cert_is_certpath_len(p,l) (cert_is_capipath_len(p,l) || cert_is_pkcspath_len(p,l))

#endif /* USE_CAPI */

25 changes: 10 additions & 15 deletions windows/winpgnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,10 @@ void keylist_update(void)
#ifdef PUTTY_CAC
if (cert_is_certpath(skey->comment))
{
*strrchr(listentry, ' ') = '\0';
char * iden = dupstr(skey->comment);
if (strrchr(iden, '=') != NULL) *strrchr(iden, '=') = '\0';
char * listentrynew = dupprintf("%s\t%s\t%s", listentry,
IDEN_SPLIT(iden), IDEN_TYPE(iden));
sfree(iden);
sfree(listentry);
listentry = listentrynew;
// reformat the list entry to be more readable by trimming off
// everything after the CAPI or PKCS comment identifier
if (strrchr(listentry, '=') != NULL) *strrchr(listentry, '=') = '\0';
if (strrchr(listentry, ':') != NULL) *strrchr(listentry, ':') = '\0';
}
#endif
pos = 0;
Expand Down Expand Up @@ -1388,21 +1384,20 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
(UINT_PTR) session_menu, "&Saved Sessions");
AppendMenu(systray_menu, MF_SEPARATOR, 0, 0);
}
AppendMenu(systray_menu, MF_ENABLED, IDM_VIEWKEYS,
#ifdef PUTTY_CAC
"&View Keys && Certs");
#else
"&View Keys");
#endif
AppendMenu(systray_menu, MF_ENABLED, IDM_ADDKEY, "Add &Key");
#ifdef PUTTY_CAC
AppendMenu(systray_menu, MF_ENABLED, IDM_VIEWKEYS, "&View Keys && Certs");
AppendMenu(systray_menu, MF_ENABLED, IDM_ADDKEY, "Add PuTTY &Key");
AppendMenu(systray_menu, MF_ENABLED, IDM_ADDCAPI, "Add &CAPI Cert");
AppendMenu(systray_menu, MF_ENABLED, IDM_ADDPKCS, "Add &PKCS Cert");
AppendMenu(systray_menu, MF_SEPARATOR, 0, 0);
AppendMenu(systray_menu, MF_ENABLED | (AutoloadCerts)
? MF_CHECKED : MF_UNCHECKED, IDM_AUTOCERT, "Autoload Certs");
AppendMenu(systray_menu, MF_ENABLED | (ForcePinCaching)
? MF_CHECKED : MF_UNCHECKED, IDM_PINCACHE, "Force PIN Caching");
#else
AppendMenu(systray_menu, MF_ENABLED, IDM_VIEWKEYS,
"&View Keys");
AppendMenu(systray_menu, MF_ENABLED, IDM_ADDKEY, "Add &Key");
#endif // PUTTY_CAC
AppendMenu(systray_menu, MF_SEPARATOR, 0, 0);
if (has_help())
Expand Down

0 comments on commit 9f028fa

Please sign in to comment.