mirror of https://github.com/macssh/macssh.git
added Rolf's kerberos patches
This commit is contained in:
parent
b88246f937
commit
762fa2cfa4
|
@ -147,7 +147,7 @@ typedef struct {
|
||||||
authenticate, // Kerberos authentication
|
authenticate, // Kerberos authentication
|
||||||
encrypt, // Encrypted session
|
encrypt, // Encrypted session
|
||||||
localecho, // Force local echo on?
|
localecho, // Force local echo on?
|
||||||
reserved1; // Reserved by JMB - NCSA
|
forward; // Reserved by JMB - NCSA
|
||||||
|
|
||||||
short
|
short
|
||||||
NetBlockSize, // Size of read buffer (2.7 CCP)
|
NetBlockSize, // Size of read buffer (2.7 CCP)
|
||||||
|
|
|
@ -49,7 +49,9 @@
|
||||||
#define NCencrypt 9
|
#define NCencrypt 9
|
||||||
#define NCfavoritename 10
|
#define NCfavoritename 10
|
||||||
#define NCssh2 11
|
#define NCssh2 11
|
||||||
#define NCtermpopup 12
|
//#define NCtermpopup 12
|
||||||
|
#define NCforward 12
|
||||||
|
#define NCusername 13
|
||||||
|
|
||||||
#define TermPopupMenu 1004
|
#define TermPopupMenu 1004
|
||||||
#define SessPopupMenu 1005
|
#define SessPopupMenu 1005
|
||||||
|
|
|
@ -233,7 +233,8 @@ char
|
||||||
|
|
||||||
Boolean
|
Boolean
|
||||||
authenticate, // true if authenticating connection wanted
|
authenticate, // true if authenticating connection wanted
|
||||||
encrypt; // true if encrypting connection wanted
|
encrypt, // true if encrypting connection wanted
|
||||||
|
forward; // true if fowarding wanted
|
||||||
|
|
||||||
NewMacroInfo sessmacros;
|
NewMacroInfo sessmacros;
|
||||||
|
|
||||||
|
|
|
@ -1751,6 +1751,7 @@ void ShowSessPanel(DialogPtr dptr, short panel)
|
||||||
case 4:
|
case 4:
|
||||||
ShowDialogItemRange(dptr, 15, 16);
|
ShowDialogItemRange(dptr, 15, 16);
|
||||||
ShowDialogItemRange(dptr, 53, 61);
|
ShowDialogItemRange(dptr, 53, 61);
|
||||||
|
ShowDialogItem(dptr, 92);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
|
@ -1810,6 +1811,7 @@ void HideSessPanel(DialogPtr dptr, short panel)
|
||||||
case 4:
|
case 4:
|
||||||
HideDialogItemRange(dptr, 15, 16);
|
HideDialogItemRange(dptr, 15, 16);
|
||||||
HideDialogItemRange(dptr, 53, 61);
|
HideDialogItemRange(dptr, 53, 61);
|
||||||
|
HideDialogItem(dptr, 92);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
|
@ -1906,6 +1908,7 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
|
||||||
SetCntrl(dptr, SessHalfDuplex, SessPrefsPtr->halfdup);
|
SetCntrl(dptr, SessHalfDuplex, SessPrefsPtr->halfdup);
|
||||||
SetCntrl(dptr, SessAuthenticate, SessPrefsPtr->authenticate);
|
SetCntrl(dptr, SessAuthenticate, SessPrefsPtr->authenticate);
|
||||||
SetCntrl(dptr, SessEncrypt, SessPrefsPtr->encrypt);
|
SetCntrl(dptr, SessEncrypt, SessPrefsPtr->encrypt);
|
||||||
|
SetCntrl(dptr, 92, SessPrefsPtr->forward);
|
||||||
SetCntrl(dptr, SessLocalEcho, SessPrefsPtr->localecho);
|
SetCntrl(dptr, SessLocalEcho, SessPrefsPtr->localecho);
|
||||||
SetCntrl(dptr, 46, SessPrefsPtr->otpauto);
|
SetCntrl(dptr, 46, SessPrefsPtr->otpauto);
|
||||||
SetCntrl(dptr, 47, SessPrefsPtr->otpmulti);
|
SetCntrl(dptr, 47, SessPrefsPtr->otpmulti);
|
||||||
|
@ -1941,14 +1944,18 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
|
||||||
if (!authOK) {
|
if (!authOK) {
|
||||||
Hilite( dptr, SessAuthenticate, 255);
|
Hilite( dptr, SessAuthenticate, 255);
|
||||||
Hilite( dptr, SessEncrypt, 255);
|
Hilite( dptr, SessEncrypt, 255);
|
||||||
|
Hilite( dptr, 92, 255);
|
||||||
} else if (!encryptOK) {
|
} else if (!encryptOK) {
|
||||||
Hilite( dptr, SessEncrypt, 255);
|
Hilite( dptr, SessEncrypt, 255);
|
||||||
}
|
}
|
||||||
if (GetCntlVal(dptr, SessAuthenticate)) {
|
if (GetCntlVal(dptr, SessAuthenticate)) {
|
||||||
Hilite(dptr, SessEncrypt, (encryptOK)? 0 : 255);
|
Hilite(dptr, SessEncrypt, (encryptOK)? 0 : 255);
|
||||||
|
Hilite(dptr, 92, 0);
|
||||||
} else {
|
} else {
|
||||||
Hilite(dptr, SessEncrypt, 255);
|
Hilite(dptr, SessEncrypt, 255);
|
||||||
|
Hilite( dptr, 92, 255);
|
||||||
SetCntrl(dptr, SessEncrypt, false);
|
SetCntrl(dptr, SessEncrypt, false);
|
||||||
|
SetCntrl(dptr, 92, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
configPassword[0] = 0;
|
configPassword[0] = 0;
|
||||||
|
@ -2097,9 +2104,12 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
|
||||||
FlipCheckBox(dptr, ditem);
|
FlipCheckBox(dptr, ditem);
|
||||||
if (GetCntlVal(dptr, SessAuthenticate)) {
|
if (GetCntlVal(dptr, SessAuthenticate)) {
|
||||||
Hilite(dptr, SessEncrypt, (encryptOK)? 0 : 255);
|
Hilite(dptr, SessEncrypt, (encryptOK)? 0 : 255);
|
||||||
|
Hilite(dptr, 92, 0);
|
||||||
} else {
|
} else {
|
||||||
Hilite(dptr, SessEncrypt, 255);
|
Hilite(dptr, SessEncrypt, 255);
|
||||||
|
Hilite(dptr, 92, 255);
|
||||||
SetCntrl(dptr, SessEncrypt, false);
|
SetCntrl(dptr, SessEncrypt, false);
|
||||||
|
SetCntrl(dptr, 92, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2127,6 +2137,7 @@ Boolean EditSession(StringPtr PrefRecordNamePtr)
|
||||||
case 78:
|
case 78:
|
||||||
case 87:
|
case 87:
|
||||||
case 91:
|
case 91:
|
||||||
|
case 92:
|
||||||
/* NONO */
|
/* NONO */
|
||||||
FlipCheckBox(dptr, ditem);
|
FlipCheckBox(dptr, ditem);
|
||||||
break;
|
break;
|
||||||
|
@ -2380,6 +2391,7 @@ void SetSessionData(DialogPtr dptr, SessionPrefs *SessPrefsPtr,
|
||||||
SessPrefsPtr->halfdup = GetCntlVal(dptr, SessHalfDuplex);
|
SessPrefsPtr->halfdup = GetCntlVal(dptr, SessHalfDuplex);
|
||||||
SessPrefsPtr->authenticate = GetCntlVal(dptr, SessAuthenticate);
|
SessPrefsPtr->authenticate = GetCntlVal(dptr, SessAuthenticate);
|
||||||
SessPrefsPtr->encrypt = GetCntlVal(dptr, SessEncrypt);
|
SessPrefsPtr->encrypt = GetCntlVal(dptr, SessEncrypt);
|
||||||
|
SessPrefsPtr->forward = GetCntlVal(dptr, 92);
|
||||||
SessPrefsPtr->localecho = GetCntlVal(dptr, SessLocalEcho);
|
SessPrefsPtr->localecho = GetCntlVal(dptr, SessLocalEcho);
|
||||||
SessPrefsPtr->otpauto = GetCntlVal(dptr, 46);
|
SessPrefsPtr->otpauto = GetCntlVal(dptr, 46);
|
||||||
SessPrefsPtr->otpmulti = GetCntlVal(dptr, 47);
|
SessPrefsPtr->otpmulti = GetCntlVal(dptr, 47);
|
||||||
|
|
|
@ -142,6 +142,10 @@ pascal short POCdlogfilter( DialogPtr dptr, EventRecord *evt, short *item)
|
||||||
*item = NCssh2;
|
*item = NCssh2;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if ( key == 'F' || key == 'f' ) {
|
||||||
|
*item = NCforward;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((evt->what == keyDown) || (evt->what == autoKey)) {
|
if ((evt->what == keyDown) || (evt->what == autoKey)) {
|
||||||
|
@ -223,6 +227,7 @@ static void SetCurrentSession(DialogPtr dptr, Str255 scratchPstring)
|
||||||
SelectDialogItemText(dptr, NChostname, 0, 32767);
|
SelectDialogItemText(dptr, NChostname, 0, 32767);
|
||||||
SetCntrl(dptr, NCauthenticate, (**tempSessHdl).authenticate);//update the auth status
|
SetCntrl(dptr, NCauthenticate, (**tempSessHdl).authenticate);//update the auth status
|
||||||
SetCntrl(dptr, NCencrypt, (**tempSessHdl).encrypt);
|
SetCntrl(dptr, NCencrypt, (**tempSessHdl).encrypt);
|
||||||
|
SetCntrl(dptr, NCforward, (**tempSessHdl).forward);
|
||||||
SetCntrl(dptr, NCssh2, (**tempSessHdl).protocol == 4);
|
SetCntrl(dptr, NCssh2, (**tempSessHdl).protocol == 4);
|
||||||
setSessStates(dptr);//encrypt cant be on w/o authenticate
|
setSessStates(dptr);//encrypt cant be on w/o authenticate
|
||||||
ReleaseResource((Handle)tempSessHdl);
|
ReleaseResource((Handle)tempSessHdl);
|
||||||
|
@ -316,6 +321,7 @@ Boolean PresentOpenConnectionDialog(void)
|
||||||
if (!authOK) {
|
if (!authOK) {
|
||||||
Hilite( dptr, NCauthenticate, 255);
|
Hilite( dptr, NCauthenticate, 255);
|
||||||
Hilite( dptr, NCencrypt, 255);
|
Hilite( dptr, NCencrypt, 255);
|
||||||
|
Hilite( dptr, NCforward, 255);
|
||||||
} else if (!encryptOK) {
|
} else if (!encryptOK) {
|
||||||
Hilite( dptr, NCencrypt, 255);
|
Hilite( dptr, NCencrypt, 255);
|
||||||
}
|
}
|
||||||
|
@ -344,6 +350,7 @@ Boolean PresentOpenConnectionDialog(void)
|
||||||
{
|
{
|
||||||
case NCauthenticate:
|
case NCauthenticate:
|
||||||
case NCencrypt:
|
case NCencrypt:
|
||||||
|
case NCforward:
|
||||||
GetDialogItem(dptr, ditem, &scratchshort, &ItemHandle, &scratchRect);
|
GetDialogItem(dptr, ditem, &scratchshort, &ItemHandle, &scratchRect);
|
||||||
if ((**(ControlHandle)ItemHandle).contrlHilite == 0) { // if control not disabled
|
if ((**(ControlHandle)ItemHandle).contrlHilite == 0) { // if control not disabled
|
||||||
FlipCheckBox(dptr, ditem);
|
FlipCheckBox(dptr, ditem);
|
||||||
|
@ -509,6 +516,7 @@ Boolean PresentOpenConnectionDialog(void)
|
||||||
|
|
||||||
(**(**InitParams).session).authenticate = GetCntlVal(dptr, NCauthenticate);
|
(**(**InitParams).session).authenticate = GetCntlVal(dptr, NCauthenticate);
|
||||||
(**(**InitParams).session).encrypt = GetCntlVal(dptr, NCencrypt);
|
(**(**InitParams).session).encrypt = GetCntlVal(dptr, NCencrypt);
|
||||||
|
(**(**InitParams).session).forward = GetCntlVal(dptr, NCforward);
|
||||||
|
|
||||||
if ( GetCntlVal(dptr, NCssh2) ) {
|
if ( GetCntlVal(dptr, NCssh2) ) {
|
||||||
if ((**(**InitParams).session).protocol != 4) {
|
if ((**(**InitParams).session).protocol != 4) {
|
||||||
|
@ -559,9 +567,12 @@ static void setSessStates (DialogPtr dptr)
|
||||||
{
|
{
|
||||||
if (GetCntlVal(dptr, NCauthenticate)) {
|
if (GetCntlVal(dptr, NCauthenticate)) {
|
||||||
Hilite(dptr, NCencrypt, (encryptOK)? 0 : 255);
|
Hilite(dptr, NCencrypt, (encryptOK)? 0 : 255);
|
||||||
|
Hilite(dptr, NCforward, 0);
|
||||||
} else {
|
} else {
|
||||||
Hilite(dptr, NCencrypt, 255);
|
Hilite(dptr, NCencrypt, 255);
|
||||||
SetCntrl(dptr, NCencrypt, false);
|
SetCntrl(dptr, NCencrypt, false);
|
||||||
|
Hilite(dptr, NCforward, 255);
|
||||||
|
SetCntrl(dptr, NCforward, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,6 +732,7 @@ Boolean CreateConnectionFromParams( ConnInitParams **Params)
|
||||||
|
|
||||||
theScreen->authenticate = SessPtr->authenticate;
|
theScreen->authenticate = SessPtr->authenticate;
|
||||||
theScreen->encrypt = SessPtr->encrypt;
|
theScreen->encrypt = SessPtr->encrypt;
|
||||||
|
theScreen->forward = SessPtr->forward;
|
||||||
|
|
||||||
theScreen->aedata = NULL;
|
theScreen->aedata = NULL;
|
||||||
|
|
||||||
|
|
|
@ -478,15 +478,8 @@ short netread(short pnum, void *buffer, short n)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decrypt data */
|
/* Decrypt data */
|
||||||
if (p->aedata && ((tnParams *)p->aedata)->decrypting) {
|
if (p->aedata && ((tnParams *)p->aedata)->decrypting)
|
||||||
unsigned char *cp = (unsigned char *)buffer;
|
decrypt((tnParams *)p->aedata, buffer, (long)reqdamt);
|
||||||
short len = reqdamt;
|
|
||||||
|
|
||||||
while (len-- > 0) {
|
|
||||||
*cp = decrypt((tnParams *)p->aedata, (long)(*cp));
|
|
||||||
cp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyPBreturn(pbp);
|
MyPBreturn(pbp);
|
||||||
return(reqdamt);
|
return(reqdamt);
|
||||||
|
|
|
@ -33,7 +33,14 @@ enum {
|
||||||
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
|
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
|
||||||
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
|
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
#define PluginProc(userRoutine, code, pointer) \
|
||||||
|
CallUniversalProc((UniversalProcPtr)(userRoutine), uppModule, code, pointer)
|
||||||
|
#else /* powerc */
|
||||||
|
|
||||||
|
#define PluginProc(userRoutine, code, pointer) \
|
||||||
|
(*(userRoutine))(code, pointer)
|
||||||
|
#endif /* powerc */
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
#pragma profile off
|
#pragma profile off
|
||||||
|
@ -90,13 +97,9 @@ void auth_encrypt_end(tnParams **aedata)
|
||||||
int i;
|
int i;
|
||||||
OSErr s;
|
OSErr s;
|
||||||
tnParams *tn = *aedata;
|
tnParams *tn = *aedata;
|
||||||
|
|
||||||
#ifdef powerc
|
if (tn->entry)
|
||||||
s = CallUniversalProc((UniversalProcPtr)tn->entry, uppModule,
|
s = PluginProc(tn->entry, TNFUNC_END_SESSION, tn);
|
||||||
TNFUNC_END_SESSION, tn);
|
|
||||||
#else
|
|
||||||
s = (tn->entry)(TNFUNC_END_SESSION, tn);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scanFolder(short vRef, long dirID)
|
static void scanFolder(short vRef, long dirID)
|
||||||
|
@ -161,15 +164,10 @@ void loadCode (HParamBlockRec *pb, long dirid, Str255 name, OSType type, codemod
|
||||||
* It should preset the type/pairs list and return the number of
|
* It should preset the type/pairs list and return the number of
|
||||||
* pairs entered.
|
* pairs entered.
|
||||||
*/
|
*/
|
||||||
#ifdef powerc
|
|
||||||
code->npairs = CallUniversalProc((UniversalProcPtr)code->entry, uppModule,
|
code->npairs = PluginProc(code->entry, TNFUNC_INIT_CODE, &code->pairs);
|
||||||
TNFUNC_INIT_CODE, &code->pairs);
|
code->encryptok = PluginProc(code->entry, TNFUNC_QUERY_ENCRYPT, 0);
|
||||||
code->encryptok = CallUniversalProc((UniversalProcPtr)code->entry, uppModule,
|
|
||||||
TNFUNC_QUERY_ENCRYPT, 0);
|
|
||||||
#else
|
|
||||||
code->npairs = (*code->entry)(TNFUNC_INIT_CODE, &code->pairs);
|
|
||||||
code->encryptok = (*code->entry)(TNFUNC_QUERY_ENCRYPT, 0);
|
|
||||||
#endif
|
|
||||||
qlink((void **)header, code);
|
qlink((void **)header, code);
|
||||||
} else
|
} else
|
||||||
ReleaseResource(h);
|
ReleaseResource(h);
|
||||||
|
@ -187,7 +185,7 @@ void loadCode (HParamBlockRec *pb, long dirid, Str255 name, OSType type, codemod
|
||||||
*/
|
*/
|
||||||
void auth_suboption (tnParams **aedata, unsigned char *subbuffer, long sublength,
|
void auth_suboption (tnParams **aedata, unsigned char *subbuffer, long sublength,
|
||||||
unsigned char *sendbuffer, unsigned long *sendlength, char *cname, Boolean hisencrypt,
|
unsigned char *sendbuffer, unsigned long *sendlength, char *cname, Boolean hisencrypt,
|
||||||
Boolean myencrypt, unsigned short port)
|
Boolean myencrypt, unsigned short port, Boolean forward, char *username)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
OSErr s;
|
OSErr s;
|
||||||
|
@ -252,34 +250,23 @@ void auth_suboption (tnParams **aedata, unsigned char *subbuffer, long sublength
|
||||||
* If no auth data, initialize it now.
|
* If no auth data, initialize it now.
|
||||||
*/
|
*/
|
||||||
if (!(tn->authdata)) {
|
if (!(tn->authdata)) {
|
||||||
netgetip(tn->ipaddr);
|
|
||||||
tn->port = netgetport(port);
|
|
||||||
switch (code->authType) {
|
switch (code->authType) {
|
||||||
case 'TNae':
|
case 'TNae':
|
||||||
#ifdef powerc
|
s = PluginProc(code->entry, TNFUNC_INIT_SESSION_AUTH, &tn->authdata);
|
||||||
s = CallUniversalProc((UniversalProcPtr)code->entry, uppModule,
|
if ((s == 0) && !tn->encryptdata) {
|
||||||
TNFUNC_INIT_SESSION_AUTH, &tn->authdata);
|
s = PluginProc(code->entry, TNFUNC_INIT_SESSION_ENCRYPT, &tn->encryptdata);
|
||||||
if ((s == 0) && !tn->encryptdata)
|
tn->encrType = code->authType;
|
||||||
s = CallUniversalProc((UniversalProcPtr)code->entry, uppModule,
|
}
|
||||||
TNFUNC_INIT_SESSION_ENCRYPT, &tn->encryptdata);
|
break;
|
||||||
#else
|
|
||||||
s = (*code->entry)(TNFUNC_INIT_SESSION_AUTH, &tn->authdata);
|
|
||||||
if ((s == 0) && !tn->encryptdata)
|
|
||||||
s = (*code->entry)(TNFUNC_INIT_SESSION_ENCRYPT, &tn->encryptdata);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
#ifdef powerc
|
netgetip(tn->ipaddr);
|
||||||
s = CallUniversalProc((UniversalProcPtr)code->entry, uppModule,
|
tn->port = netgetport(port);
|
||||||
TNFUNC_INIT_SESSION_AUTH, tn);
|
tn->username = username;
|
||||||
if ((s == 0) && !tn->encryptdata)
|
s = PluginProc(code->entry, TNFUNC_INIT_SESSION_AUTH, tn);
|
||||||
s = CallUniversalProc((UniversalProcPtr)code->entry, uppModule,
|
if ((s == 0) && !tn->encryptdata) {
|
||||||
TNFUNC_INIT_SESSION_ENCRYPT, tn);
|
s = PluginProc(code->entry, TNFUNC_INIT_SESSION_ENCRYPT, tn);
|
||||||
#else
|
tn->encrType = code->authType;
|
||||||
s = (*code->entry)(TNFUNC_INIT_SESSION_AUTH, tn);
|
}
|
||||||
if ((s == 0) && !tn->encryptdata)
|
|
||||||
s = (*code->entry)(TNFUNC_INIT_SESSION_ENCRYPT, tn);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s) { /* if no memory, etc */
|
if (s) { /* if no memory, etc */
|
||||||
|
@ -300,12 +287,7 @@ void auth_suboption (tnParams **aedata, unsigned char *subbuffer, long sublength
|
||||||
tn->cname = cname;
|
tn->cname = cname;
|
||||||
tn->hisencrypt = hisencrypt;
|
tn->hisencrypt = hisencrypt;
|
||||||
tn->myencrypt = myencrypt;
|
tn->myencrypt = myencrypt;
|
||||||
#ifdef powerc
|
s = PluginProc(tn->entry, TNFUNC_AUTH_SEND, tn);
|
||||||
s = CallUniversalProc((UniversalProcPtr)tn->entry, uppModule,
|
|
||||||
TNFUNC_AUTH_SEND, tn);
|
|
||||||
#else
|
|
||||||
s = (*tn->entry)(TNFUNC_AUTH_SEND, tn);
|
|
||||||
#endif
|
|
||||||
if (s) {
|
if (s) {
|
||||||
/* ddd null probably wrong here ??? */
|
/* ddd null probably wrong here ??? */
|
||||||
BlockMoveData((Ptr)nullbuf, (Ptr)sendbuffer, sizeof(nullbuf));
|
BlockMoveData((Ptr)nullbuf, (Ptr)sendbuffer, sizeof(nullbuf));
|
||||||
|
@ -326,14 +308,10 @@ void auth_suboption (tnParams **aedata, unsigned char *subbuffer, long sublength
|
||||||
tn->sendbuffer = sendbuffer;
|
tn->sendbuffer = sendbuffer;
|
||||||
tn->sendlength = sendlength;
|
tn->sendlength = sendlength;
|
||||||
tn->cname = cname;
|
tn->cname = cname;
|
||||||
|
tn->forward = forward ? 1 : -1;
|
||||||
tn->hisencrypt = hisencrypt;
|
tn->hisencrypt = hisencrypt;
|
||||||
tn->myencrypt = myencrypt;
|
tn->myencrypt = myencrypt;
|
||||||
#ifdef powerc
|
s = PluginProc(tn->entry, TNFUNC_AUTH_REPLY, tn);
|
||||||
s = CallUniversalProc((UniversalProcPtr)tn->entry, uppModule,
|
|
||||||
TNFUNC_AUTH_REPLY, tn);
|
|
||||||
#else
|
|
||||||
s = (*tn->entry)(TNFUNC_AUTH_REPLY, tn);
|
|
||||||
#endif
|
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case TNREP_OK:
|
case TNREP_OK:
|
||||||
return;
|
return;
|
||||||
|
@ -379,34 +357,25 @@ short encrypt_suboption (tnParams **aedata, unsigned char *subbuffer, long suble
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!code) {
|
if (!code) {
|
||||||
DisposePtr(*aedata);
|
//DisposePtr(*aedata);
|
||||||
*aedata = NULL;
|
//*aedata = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (code->authType)
|
switch (code->authType)
|
||||||
{
|
{
|
||||||
case 'TNae':
|
case 'TNae':
|
||||||
#ifdef powerc
|
s = PluginProc(code->entry, TNFUNC_INIT_SESSION_ENCRYPT, &tn->encryptdata);
|
||||||
s = CallUniversalProc((UniversalProcPtr)code->entry, uppModule,
|
break;
|
||||||
TNFUNC_INIT_SESSION_ENCRYPT, &tn->encryptdata);
|
|
||||||
#else
|
|
||||||
s = (*code->entry)(TNFUNC_INIT_SESSION_ENCRYPT, &tn->encryptdata);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
#ifdef powerc
|
s = PluginProc(code->entry, TNFUNC_INIT_SESSION_ENCRYPT, tn);
|
||||||
s = CallUniversalProc((UniversalProcPtr)code->entry, uppModule,
|
|
||||||
TNFUNC_INIT_SESSION_ENCRYPT, tn);
|
|
||||||
#else
|
|
||||||
s = (*code->entry)(TNFUNC_INIT_SESSION_ENCRYPT, tn);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
return TNREP_ERROR;
|
return TNREP_ERROR;
|
||||||
|
|
||||||
tn->entry = code->entry;
|
tn->entry = code->entry;
|
||||||
|
tn->encrType = code->authType;
|
||||||
}
|
}
|
||||||
|
|
||||||
tn->subbuffer = subbuffer;
|
tn->subbuffer = subbuffer;
|
||||||
|
@ -416,26 +385,30 @@ short encrypt_suboption (tnParams **aedata, unsigned char *subbuffer, long suble
|
||||||
tn->cname = cname;
|
tn->cname = cname;
|
||||||
tn->hisencrypt = hisencrypt;
|
tn->hisencrypt = hisencrypt;
|
||||||
tn->myencrypt = myencrypt;
|
tn->myencrypt = myencrypt;
|
||||||
#ifdef powerc
|
s = PluginProc(tn->entry, TNFUNC_ENCRYPT_SB, tn);
|
||||||
s = CallUniversalProc((UniversalProcPtr)tn->entry, uppModule,
|
|
||||||
TNFUNC_ENCRYPT_SB, tn);
|
|
||||||
#else
|
|
||||||
s = (*tn->entry)(TNFUNC_ENCRYPT_SB, tn);
|
|
||||||
#endif
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned char decrypt (tnParams *tn, long value)
|
void decrypt (tnParams *tn, unsigned char *buf, long len)
|
||||||
{
|
{
|
||||||
tn->data = value;
|
short s;
|
||||||
#ifdef powerc
|
|
||||||
CallUniversalProc((UniversalProcPtr)tn->entry, uppModule,
|
tn->data = len;
|
||||||
TNFUNC_DECRYPT, tn);
|
tn->ebuf = buf;
|
||||||
#else
|
if (tn->encrType == 'TNae')
|
||||||
(*tn->entry)(TNFUNC_DECRYPT, tn);
|
s = TNREP_ERROR;
|
||||||
#endif
|
else
|
||||||
return (unsigned char)tn->data;
|
s = PluginProc(tn->entry, TNFUNC_DECRYPT2, tn);
|
||||||
|
if (s == TNREP_ERROR) // plugin must not support TNFUNC_DECRYPT2
|
||||||
|
{
|
||||||
|
while (len-- > 0) {
|
||||||
|
tn->data = (long)*buf;
|
||||||
|
PluginProc(tn->entry, TNFUNC_DECRYPT, tn);
|
||||||
|
*buf = (unsigned char)tn->data;
|
||||||
|
buf++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -443,12 +416,7 @@ void encrypt (tnParams *tn, unsigned char *buf, long len)
|
||||||
{
|
{
|
||||||
tn->data = len;
|
tn->data = len;
|
||||||
tn->ebuf = buf;
|
tn->ebuf = buf;
|
||||||
#ifdef powerc
|
PluginProc(tn->entry, TNFUNC_ENCRYPT, tn);
|
||||||
CallUniversalProc((UniversalProcPtr)tn->entry, uppModule,
|
|
||||||
TNFUNC_ENCRYPT, tn);
|
|
||||||
#else
|
|
||||||
(*tn->entry)(TNFUNC_ENCRYPT, tn);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -528,18 +496,30 @@ short hicall (long cscode, krbHiParmBlock *khipb, short kdriver)
|
||||||
|
|
||||||
void DestroyTickets(void)
|
void DestroyTickets(void)
|
||||||
{
|
{
|
||||||
|
struct codemodule *code = NULL;
|
||||||
OSErr err;
|
OSErr err;
|
||||||
//short authRefNumkrb;
|
//short authRefNumkrb;
|
||||||
krbHiParmBlock khpb, *khipb = &khpb;
|
krbHiParmBlock khpb, *khipb = &khpb;
|
||||||
short kdriver;
|
short kdriver;
|
||||||
|
|
||||||
if (!(err = OpenDriver("\p.Kerberos", &kdriver)))
|
for (code = authmodules; code; code = code->next)
|
||||||
{
|
{
|
||||||
WriteZero((Ptr)khipb, sizeof(krbHiParmBlock));
|
switch(code->authType)
|
||||||
if (err = hicall(cKrbDeleteAllSessions, khipb, kdriver))
|
{
|
||||||
return;
|
case 'TNae':
|
||||||
|
|
||||||
|
if (!(err = OpenDriver("\p.Kerberos", &kdriver)))
|
||||||
|
{
|
||||||
|
WriteZero((Ptr)khipb, sizeof(krbHiParmBlock));
|
||||||
|
if (err = hicall(cKrbDeleteAllSessions, khipb, kdriver))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//else if (!(err=openAuthMan(&authRefNum,&authAPIversion)))
|
||||||
|
// if (err=expireV4Ticket(authRefNum,NULL,NULL,NULL))
|
||||||
|
// return;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
PluginProc(code->entry, TNFUNC_DESTROY_CREDS, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//else if (!(err=openAuthMan(&authRefNum,&authAPIversion)))
|
|
||||||
// if (err=expireV4Ticket(authRefNum,NULL,NULL,NULL))
|
|
||||||
// return;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
* :main:authencrypt.c
|
* :main:authencrypt.c
|
||||||
*/
|
*/
|
||||||
Boolean auth_encrypt_init(void);
|
Boolean auth_encrypt_init(void);
|
||||||
void auth_suboption(tnParams **aedata, unsigned char *subbuffer, long sublength, unsigned char *sendbuffer, unsigned long *sendlength, char *cname, Boolean hisencrypt, Boolean myencrypt, unsigned short port);
|
void auth_suboption(tnParams **aedata, unsigned char *subbuffer, long sublength, unsigned char *sendbuffer, unsigned long *sendlength, char *cname, Boolean hisencrypt, Boolean myencrypt, unsigned short port, Boolean forward, char *username);
|
||||||
void auth_encrypt_end(tnParams **aedata);
|
void auth_encrypt_end(tnParams **aedata);
|
||||||
short encrypt_suboption(tnParams **aedata, unsigned char *subbuffer, long sublength, unsigned char *sendbuffer, unsigned long *sendlength, char *cname, Boolean hisencrypt, Boolean myencrypt);
|
short encrypt_suboption(tnParams **aedata, unsigned char *subbuffer, long sublength, unsigned char *sendbuffer, unsigned long *sendlength, char *cname, Boolean hisencrypt, Boolean myencrypt);
|
||||||
unsigned char decrypt(tnParams *tn, long value);
|
void decrypt(tnParams *tn, unsigned char *buf, long value);
|
||||||
void encrypt(tnParams *tn, unsigned char *buf, long len);
|
void encrypt(tnParams *tn, unsigned char *buf, long len);
|
||||||
void qlink(void **flist, void *fentry);
|
void qlink(void **flist, void *fentry);
|
||||||
void *qunlink(void **flist, void *fentry);
|
void *qunlink(void **flist, void *fentry);
|
||||||
|
|
|
@ -63,6 +63,10 @@ static void telnet_do(struct WindRec *tw, short option);
|
||||||
static void telnet_dont(struct WindRec *tw, short option);
|
static void telnet_dont(struct WindRec *tw, short option);
|
||||||
static void telnet_will(struct WindRec *tw, short option);
|
static void telnet_will(struct WindRec *tw, short option);
|
||||||
static void telnet_wont(struct WindRec *tw, short option);
|
static void telnet_wont(struct WindRec *tw, short option);
|
||||||
|
static void env_opt_start(void);
|
||||||
|
static void env_opt_add(char *, char *);
|
||||||
|
static void env_opt_end(void);
|
||||||
|
static int opt_welldefined(char *);
|
||||||
|
|
||||||
void Parseunload(void) {}
|
void Parseunload(void) {}
|
||||||
|
|
||||||
|
@ -575,9 +579,81 @@ void SendNAWSinfo(WindRec *s, short horiz, short vert)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Implementation specific Kerberos routines
|
* telnet environment passing routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define OPT_REPLY_SIZE 256
|
||||||
|
unsigned char opt_reply[OPT_REPLY_SIZE];
|
||||||
|
unsigned char *opt_replyp;
|
||||||
|
|
||||||
|
void
|
||||||
|
env_opt_start(void)
|
||||||
|
{
|
||||||
|
opt_replyp = opt_reply;
|
||||||
|
|
||||||
|
*opt_replyp++ = IAC;
|
||||||
|
*opt_replyp++ = SB;
|
||||||
|
*opt_replyp++ = N_NEW_ENVIRON;
|
||||||
|
*opt_replyp++ = TNQ_IS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
env_opt_add(char *ep, char *vp)
|
||||||
|
{
|
||||||
|
unsigned char c;
|
||||||
|
|
||||||
|
if (opt_welldefined(ep))
|
||||||
|
*opt_replyp++ = NEW_ENV_VAR;
|
||||||
|
else
|
||||||
|
*opt_replyp++ = ENV_USERVAR;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
while (c = *ep++) {
|
||||||
|
switch(c&0xff) {
|
||||||
|
case IAC:
|
||||||
|
*opt_replyp++ = IAC;
|
||||||
|
break;
|
||||||
|
case NEW_ENV_VAR:
|
||||||
|
case NEW_ENV_VALUE:
|
||||||
|
case ENV_ESC:
|
||||||
|
case ENV_USERVAR:
|
||||||
|
*opt_replyp++ = ENV_ESC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*opt_replyp++ = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ep = vp) {
|
||||||
|
*opt_replyp++ = NEW_ENV_VALUE;
|
||||||
|
vp = NULL;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
opt_welldefined(char *ep)
|
||||||
|
{
|
||||||
|
if ((strcmp(ep, "USER") == 0) ||
|
||||||
|
(strcmp(ep, "DISPLAY") == 0) ||
|
||||||
|
(strcmp(ep, "PRINTER") == 0) ||
|
||||||
|
(strcmp(ep, "SYSTEMTYPE") == 0) ||
|
||||||
|
(strcmp(ep, "JOB") == 0) ||
|
||||||
|
(strcmp(ep, "ACCT") == 0))
|
||||||
|
return(1);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
env_opt_end()
|
||||||
|
{
|
||||||
|
*opt_replyp++ = IAC;
|
||||||
|
*opt_replyp++ = SE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation specific Kerberos routines
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getcname
|
* getcname
|
||||||
|
@ -739,11 +815,7 @@ static void process_suboption(struct WindRec *tw, unsigned char *start, unsigned
|
||||||
* If we turned on encryption, we must decrypt the rest of the buffer.
|
* If we turned on encryption, we must decrypt the rest of the buffer.
|
||||||
*/
|
*/
|
||||||
if (s == TNREP_START_DECRYPT) {
|
if (s == TNREP_START_DECRYPT) {
|
||||||
unsigned char *cp = start;
|
decrypt((tnParams *)tw->aedata, start, (long)(end-start));
|
||||||
while (cp < end) {
|
|
||||||
*cp = decrypt((tnParams *)tw->aedata, (long)(*cp));
|
|
||||||
cp++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizeof(sendbuffer) - sendlength)
|
if (sizeof(sendbuffer) - sendlength)
|
||||||
|
@ -771,7 +843,7 @@ static void process_suboption(struct WindRec *tw, unsigned char *start, unsigned
|
||||||
sendbuffer, &sendlength, getcname(tw),
|
sendbuffer, &sendlength, getcname(tw),
|
||||||
tw->hisopts[OPT_ENCRYPT-MHOPTS_BASE],
|
tw->hisopts[OPT_ENCRYPT-MHOPTS_BASE],
|
||||||
tw->myopts[OPT_ENCRYPT-MHOPTS_BASE],
|
tw->myopts[OPT_ENCRYPT-MHOPTS_BASE],
|
||||||
tw->port);
|
tw->port, tw->forward, tw->username);
|
||||||
if (sizeof(sendbuffer) - sendlength) {
|
if (sizeof(sendbuffer) - sendlength) {
|
||||||
netwrite(tw->port, sendbuffer, sizeof(sendbuffer)-sendlength);
|
netwrite(tw->port, sendbuffer, sizeof(sendbuffer)-sendlength);
|
||||||
}
|
}
|
||||||
|
@ -827,6 +899,41 @@ static void process_suboption(struct WindRec *tw, unsigned char *start, unsigned
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
/*------------------------------------------------------------------------------*
|
||||||
|
* SUBNegotiate Environment: pass username as USER
|
||||||
|
*
|
||||||
|
*------------------------------------------------------------------------------*/
|
||||||
|
case N_NEW_ENVIRON:
|
||||||
|
switch (tw->parsedat[1])
|
||||||
|
{
|
||||||
|
case TNQ_SEND:
|
||||||
|
#ifdef OPTS_DEBUG
|
||||||
|
sprintf(munger, "RECV: SB NEW_ENVIRON SEND");
|
||||||
|
opts_debug_print(munger);
|
||||||
|
#endif
|
||||||
|
env_opt_start();
|
||||||
|
|
||||||
|
p2cstr((unsigned char *)tw->username);
|
||||||
|
env_opt_add("USER", tw->username);
|
||||||
|
c2pstr(tw->username);
|
||||||
|
|
||||||
|
env_opt_end();
|
||||||
|
|
||||||
|
netwrite(tw->port, opt_reply, opt_replyp - opt_reply);
|
||||||
|
netpush(tw->port);
|
||||||
|
#ifdef OPTS_DEBUG
|
||||||
|
sprintf(munger, "SENT: SB NEW_ENVIRON IS USER <value>");
|
||||||
|
opts_debug_print(munger);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
#ifdef OPTS_DEBUG
|
||||||
|
sprintf(munger, "RECV: SB NEW_ENVIRON unsupported suboption");
|
||||||
|
opts_debug_print(munger);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default: //dont know this subnegotiation!!
|
default: //dont know this subnegotiation!!
|
||||||
break;
|
break;
|
||||||
|
@ -897,6 +1004,13 @@ static void telnet_do(struct WindRec *tw, short option)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case N_NEW_ENVIRON:
|
||||||
|
if (tw->username[0])
|
||||||
|
send_will(tw->port, N_NEW_ENVIRON);
|
||||||
|
else
|
||||||
|
send_wont(tw->port, option);
|
||||||
|
break;
|
||||||
|
|
||||||
case N_REMOTEFLOW:
|
case N_REMOTEFLOW:
|
||||||
if (!tw->remote_flow)
|
if (!tw->remote_flow)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,13 @@
|
||||||
#define N_XDISPLOC 35
|
#define N_XDISPLOC 35
|
||||||
#define N_AUTHENTICATION 37 /* Authentication */
|
#define N_AUTHENTICATION 37 /* Authentication */
|
||||||
#define N_ENCRYPT 38 /* Encryption */
|
#define N_ENCRYPT 38 /* Encryption */
|
||||||
|
#define N_NEW_ENVIRON 39
|
||||||
|
|
||||||
|
/* values for NEW ENVIRON */
|
||||||
|
#define NEW_ENV_VAR 0
|
||||||
|
#define NEW_ENV_VALUE 1
|
||||||
|
#define ENV_ESC 2
|
||||||
|
#define ENV_USERVAR 3
|
||||||
|
|
||||||
/* Values for LINEMODE MODE */
|
/* Values for LINEMODE MODE */
|
||||||
#define L_EDIT 1
|
#define L_EDIT 1
|
||||||
|
|
|
@ -102,7 +102,9 @@ enum {
|
||||||
TNFUNC_ENCRYPT_SB, /* process encryption sub-options */
|
TNFUNC_ENCRYPT_SB, /* process encryption sub-options */
|
||||||
TNFUNC_DECRYPT, /* decrypt data */
|
TNFUNC_DECRYPT, /* decrypt data */
|
||||||
TNFUNC_ENCRYPT, /* encrypt data */
|
TNFUNC_ENCRYPT, /* encrypt data */
|
||||||
TNFUNC_END_SESSION /* cleanup session data */
|
TNFUNC_END_SESSION, /* cleanup session data */
|
||||||
|
TNFUNC_DESTROY_CREDS, /* destroy credentials */
|
||||||
|
TNFUNC_DECRYPT2 /* more efficient decrypt data */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,11 +143,16 @@ typedef struct tnParams_ {
|
||||||
Boolean encrypting; /* we are encrypting */
|
Boolean encrypting; /* we are encrypting */
|
||||||
Boolean startencrypting; /* time to start encrypting */
|
Boolean startencrypting; /* time to start encrypting */
|
||||||
Boolean decrypting; /* we are decrypting */
|
Boolean decrypting; /* we are decrypting */
|
||||||
|
char forward; /* forward credentials, -1 = don't forward */
|
||||||
long data; /* for encrypt/decrypt */
|
long data; /* for encrypt/decrypt */
|
||||||
unsigned char *ebuf; /* encrypt buf */
|
unsigned char *ebuf; /* encrypt buf */
|
||||||
|
|
||||||
unsigned char ipaddr[4]; /* for authentication forwarding in kerberos5 */
|
unsigned char ipaddr[4]; /* for authentication forwarding in kerberos5 */
|
||||||
unsigned short port; /* for authentication forwarding in kerberos5 */
|
unsigned short port; /* for authentication forwarding in kerberos5 */
|
||||||
|
|
||||||
|
char *username; /* alternate username */
|
||||||
|
unsigned char padding[8]; /* for the future... */
|
||||||
|
OSType encrType; /* internal only: type from code struct */
|
||||||
} tnParams;
|
} tnParams;
|
||||||
|
|
||||||
#if PRAGMA_ALIGN_SUPPORTED
|
#if PRAGMA_ALIGN_SUPPORTED
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue