added key label in create keys dialog

This commit is contained in:
chombier 2001-03-12 15:15:58 +00:00
parent 5107c28a11
commit a2dc253683
4 changed files with 43 additions and 9 deletions

View File

@ -70,7 +70,7 @@ Boolean YesNoDialog(StringPtr prompt)
return result; return result;
} }
Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt ) Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt, Str255 comment )
{ {
DialogPtr dlog; DialogPtr dlog;
Boolean result = 0; Boolean result = 0;
@ -103,6 +103,10 @@ Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt )
//SetDialogItemText(itemHandle, "\p1024"); //SetDialogItemText(itemHandle, "\p1024");
GetDialogItem(dlog, 11, &itemType, &itemHandle, &itemRect); // Encrypt GetDialogItem(dlog, 11, &itemType, &itemHandle, &itemRect); // Encrypt
SetControlValue((ControlHandle)itemHandle, 1); SetControlValue((ControlHandle)itemHandle, 1);
if (comment) {
GetDialogItem(dlog, 12, &itemType, &itemHandle, &itemRect);
SetDialogItemText(itemHandle, comment);
}
ShowWindow(dlog); ShowWindow(dlog);
do { do {
movableModalDialog(dlogFilterUPP, &item); movableModalDialog(dlogFilterUPP, &item);
@ -154,6 +158,10 @@ Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt )
GetDialogItem(dlog, 11, &itemType, &itemHandle, &itemRect); GetDialogItem(dlog, 11, &itemType, &itemHandle, &itemRect);
*encrypt = GetControlValue((ControlHandle)itemHandle); *encrypt = GetControlValue((ControlHandle)itemHandle);
} }
if (comment) {
GetDialogItem(dlog, 12, &itemType, &itemHandle, &itemRect);
GetDialogItemText(itemHandle, comment);
}
result = 1; result = 1;
} }
DisposeDialog(dlog); DisposeDialog(dlog);
@ -216,7 +224,7 @@ RandomizeFilter(DialogPtr dlog,EventRecord *event,short *itemHit)
break; // below 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 start = (**((DialogPeek)dlog)->textH).selStart; // Get the current selection
end = (**((DialogPeek)dlog)->textH).selEnd; end = (**((DialogPeek)dlog)->textH).selEnd;

View File

@ -34,7 +34,7 @@
extern "C" { extern "C" {
#endif #endif
Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt ); Boolean SSH2RandomizeDialog( long *type, long *level, long *encrypt, Str255 label );
void SSH2ErrorDialog(char *mess1); void SSH2ErrorDialog(char *mess1);
Boolean SSH2LoginDialog(StringPtr inhost, StringPtr iologin, StringPtr outpassword); Boolean SSH2LoginDialog(StringPtr inhost, StringPtr iologin, StringPtr outpassword);

View File

@ -762,7 +762,7 @@ char *getpass( const char *prompt )
char *password; char *password;
Boolean valid; Boolean valid;
if ( wind && !strchr(prompt, '@') ) { if ( wind && /*!strchr(prompt, '@')*/ strstr(prompt, "assword for") ) {
/* password authentication */ /* password authentication */
password = wind->sshdata.currentpass; password = wind->sshdata.currentpass;
password[0] = '\0'; password[0] = '\0';
@ -1182,10 +1182,10 @@ void make_env( lshcontext *context, WindRec *w )
/*hstr = GetString( -16413 );*/ /* get computer name */ /*hstr = GetString( -16413 );*/ /* get computer name */
hstr = GetString( -16096 ); /* get user name */ hstr = GetString( -16096 ); /* get user name */
if ( hstr && *hstr ) { if ( hstr && *hstr ) {
i = **hstr; i = **hstr;
BlockMoveData( *hstr + 1, username, i ); BlockMoveData( *hstr + 1, username, i );
username[i] = 0; username[i] = 0;
ReleaseResource( (Handle)hstr ); ReleaseResource( (Handle)hstr );
context->_envv[1] = username; /* set user name */ context->_envv[1] = username; /* set user name */
} else { } else {
context->_envv[1] = NULL; context->_envv[1] = NULL;
@ -1607,6 +1607,7 @@ struct RandStruct {
int rsa; int rsa;
int level; int level;
int encrypt; int encrypt;
char label[256];
}; };
struct RandStruct gRand; struct RandStruct gRand;
@ -1725,6 +1726,11 @@ void *ssh2_randomize_thread(struct RandStruct *rnd)
/* FIXME: let the user select encryption type */ /* FIXME: let the user select encryption type */
strcat(argstr, " -c 3des"); strcat(argstr, " -c 3des");
} }
if (rnd->label[0]) {
strcat(argstr, " -l \"");
strcat(argstr, rnd->label);
strcat(argstr, "\"");
}
make_args( argstr, tabargv, &argc, &argv ); make_args( argstr, tabargv, &argc, &argv );
@ -1785,8 +1791,12 @@ void ssh_randomize(void)
long type; long type;
long level; long level;
long encrypt; long encrypt;
Str255 label;
StringHandle hstr;
char host[128];
pthread_attr_t attr = NULL; pthread_attr_t attr = NULL;
int i; int i;
int j;
struct AnimationCursRec **cursorList; struct AnimationCursRec **cursorList;
short cursorID; short cursorID;
CursHandle cursorHandle; CursHandle cursorHandle;
@ -1799,13 +1809,29 @@ void ssh_randomize(void)
goto done; 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; goto done;
} }
gRand.rsa = (type != 0); gRand.rsa = (type != 0);
gRand.level = level; gRand.level = level;
gRand.encrypt = encrypt; gRand.encrypt = encrypt;
BlockMoveData(label + 1, gRand.label, label[0]);
gRand.label[label[0]] = 0;
gmessage[0] = 0; gmessage[0] = 0;
ssh2_init(); ssh2_init();

Binary file not shown.