mirror of https://github.com/macssh/macssh.git
added key label in create keys dialog
This commit is contained in:
parent
5107c28a11
commit
a2dc253683
|
@ -70,7 +70,7 @@ Boolean YesNoDialog(StringPtr prompt)
|
|||
return result;
|
||||
}
|
||||
|
||||
Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt )
|
||||
Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt, Str255 comment )
|
||||
{
|
||||
DialogPtr dlog;
|
||||
Boolean result = 0;
|
||||
|
@ -103,6 +103,10 @@ Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt )
|
|||
//SetDialogItemText(itemHandle, "\p1024");
|
||||
GetDialogItem(dlog, 11, &itemType, &itemHandle, &itemRect); // Encrypt
|
||||
SetControlValue((ControlHandle)itemHandle, 1);
|
||||
if (comment) {
|
||||
GetDialogItem(dlog, 12, &itemType, &itemHandle, &itemRect);
|
||||
SetDialogItemText(itemHandle, comment);
|
||||
}
|
||||
ShowWindow(dlog);
|
||||
do {
|
||||
movableModalDialog(dlogFilterUPP, &item);
|
||||
|
@ -154,6 +158,10 @@ Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt )
|
|||
GetDialogItem(dlog, 11, &itemType, &itemHandle, &itemRect);
|
||||
*encrypt = GetControlValue((ControlHandle)itemHandle);
|
||||
}
|
||||
if (comment) {
|
||||
GetDialogItem(dlog, 12, &itemType, &itemHandle, &itemRect);
|
||||
GetDialogItemText(itemHandle, comment);
|
||||
}
|
||||
result = 1;
|
||||
}
|
||||
DisposeDialog(dlog);
|
||||
|
@ -216,7 +224,7 @@ RandomizeFilter(DialogPtr dlog,EventRecord *event,short *itemHit)
|
|||
break; // below
|
||||
}
|
||||
|
||||
if (((DialogPeek)dlog)->editField == 8 ) { // item-1 !!! => password
|
||||
if (((DialogPeek)dlog)->editField == 8 ) { // item-1 !!!
|
||||
start = (**((DialogPeek)dlog)->textH).selStart; // Get the current selection
|
||||
end = (**((DialogPeek)dlog)->textH).selEnd;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt );
|
||||
Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt, Str255 label );
|
||||
void SSH2ErrorDialog(char *mess1);
|
||||
|
||||
Boolean SSH2LoginDialog(StringPtr inhost, StringPtr iologin, StringPtr outpassword);
|
||||
|
|
|
@ -762,7 +762,7 @@ char *getpass( const char *prompt )
|
|||
char *password;
|
||||
Boolean valid;
|
||||
|
||||
if ( wind && !strchr(prompt, '@') ) {
|
||||
if ( wind && /*!strchr(prompt, '@')*/ strstr(prompt, "assword for") ) {
|
||||
/* password authentication */
|
||||
password = wind->sshdata.currentpass;
|
||||
password[0] = '\0';
|
||||
|
@ -1607,6 +1607,7 @@ struct RandStruct {
|
|||
int rsa;
|
||||
int level;
|
||||
int encrypt;
|
||||
char label[256];
|
||||
};
|
||||
|
||||
struct RandStruct gRand;
|
||||
|
@ -1725,6 +1726,11 @@ void *ssh2_randomize_thread(struct RandStruct *rnd)
|
|||
/* FIXME: let the user select encryption type */
|
||||
strcat(argstr, " -c 3des");
|
||||
}
|
||||
if (rnd->label[0]) {
|
||||
strcat(argstr, " -l \"");
|
||||
strcat(argstr, rnd->label);
|
||||
strcat(argstr, "\"");
|
||||
}
|
||||
|
||||
make_args( argstr, tabargv, &argc, &argv );
|
||||
|
||||
|
@ -1785,8 +1791,12 @@ void ssh_randomize(void)
|
|||
long type;
|
||||
long level;
|
||||
long encrypt;
|
||||
Str255 label;
|
||||
StringHandle hstr;
|
||||
char host[128];
|
||||
pthread_attr_t attr = NULL;
|
||||
int i;
|
||||
int j;
|
||||
struct AnimationCursRec **cursorList;
|
||||
short cursorID;
|
||||
CursHandle cursorHandle;
|
||||
|
@ -1799,13 +1809,29 @@ void ssh_randomize(void)
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (!SSH2RandomizeDialog( &type, &level, &encrypt )) {
|
||||
label[0] = 0;
|
||||
hstr = GetString( -16096 ); /* get user name */
|
||||
if ( hstr && *hstr ) {
|
||||
if ( gethostname( host, sizeof(host) ) >= 0 ) {
|
||||
i = **hstr + 1;
|
||||
BlockMoveData( *hstr, label, i );
|
||||
label[i++] = '@';
|
||||
BlockMoveData( host, label + i, j = strlen(host) );
|
||||
label[0] = i + j - 1;
|
||||
}
|
||||
ReleaseResource( (Handle)hstr );
|
||||
}
|
||||
|
||||
if (!SSH2RandomizeDialog( &type, &level, &encrypt, label)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
gRand.rsa = (type != 0);
|
||||
gRand.level = level;
|
||||
gRand.encrypt = encrypt;
|
||||
BlockMoveData(label + 1, gRand.label, label[0]);
|
||||
gRand.label[label[0]] = 0;
|
||||
|
||||
gmessage[0] = 0;
|
||||
|
||||
ssh2_init();
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue