Skip to content

Commit d1b1557

Browse files
andyclaude
andcommitted
Login dialog: no password change or account creation; editor IPC sockets bound to loopback (#236 step 0)
The Change button sent cgi-bin/ecce_accounts?...&paramo=<old>&paramn=<new> as a plain-HTTP request line. No ecce_accounts script is installed, so it only ever got 404, but Apache's access log recorded both passwords. Account creation (newUser) had no caller left. Both are removed with their dialog branches; the Change button is no longer shown. Calculation Editor, DirDyVTST and MetaDyn editors received the code-registration dialogs' datagrams on an unbound wxIPV4address, i.e. INADDR_ANY: anyone on the network could set theory and run-type values in a running editor. The dialogs send to localhost, so the sockets now bind to 127.0.0.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y1pWhDKvhakdnjg3taYGxM
1 parent 6bf5177 commit d1b1557

5 files changed

Lines changed: 22 additions & 116 deletions

File tree

‎include/wxgui/WxDavAuth.H‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ class WxDavAuth : public AuthEventListener
6060
string& password,
6161
int retryCount);
6262

63-
bool createNewUser(const string& strulg, const string& user,
64-
const string& password);
65-
bool changePassword(const string& strulg, const string& user,
66-
const string& password, const string& newPassword);
6763

6864
// True if this session has already seen `user` accepted by `host`
6965
// (any URL, via authorizationAccepted()) -- so a 401 for a

‎src/apps/calced/CalcEd.C‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3744,6 +3744,9 @@ void CalcEd::startTheoryApp(const bool& localInitFlag)
37443744
// Create datagram socket, Let Wx select a port for us - (Service(0))
37453745
wxIPV4address bindAddress;
37463746
bindAddress.Service(0);
3747+
// Only the dialog on this machine may send: unbound, anyone on the
3748+
// network could set this editor's values.
3749+
bindAddress.LocalHost();
37473750
p_theoryInSocket = new wxDatagramSocket(bindAddress);
37483751

37493752
// Check state of new socket, if its OK:
@@ -3830,6 +3833,9 @@ void CalcEd::startRuntypeApp(const bool& localInitFlag)
38303833
// Create datagram socket, Let Wx select a port for us - (Service(0))
38313834
wxIPV4address bindAddress;
38323835
bindAddress.Service(0);
3836+
// Only the dialog on this machine may send: unbound, anyone on the
3837+
// network could set this editor's values.
3838+
bindAddress.LocalHost();
38333839
p_runtypeInSocket = new wxDatagramSocket(bindAddress);
38343840

38353841
// Check state of new socket, if its OK:

‎src/apps/dirdyed/NWDirdy.C‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4141,6 +4141,9 @@ void NWDirdy::startGeneralTheoryApp(const bool& initFlag)
41414141
// Create datagram socket, Let Wx select a port for us - (Service(0))
41424142
wxIPV4address bindAddress;
41434143
bindAddress.Service(0);
4144+
// Only the dialog on this machine may send: unbound, anyone on the
4145+
// network could set this editor's values.
4146+
bindAddress.LocalHost();
41444147
p_generalTheoryInSocket = new wxDatagramSocket(bindAddress);
41454148

41464149
// Check state of new socket, if its OK:
@@ -4258,6 +4261,9 @@ void NWDirdy::startSingleTheoryApp(const bool& initFlag)
42584261
// Create datagram socket, Let Wx select a port for us - (Service(0))
42594262
wxIPV4address bindAddress;
42604263
bindAddress.Service(0);
4264+
// Only the dialog on this machine may send: unbound, anyone on the
4265+
// network could set this editor's values.
4266+
bindAddress.LocalHost();
42614267
p_singleTheoryInSocket = new wxDatagramSocket(bindAddress);
42624268

42634269
// Check state of new socket, if its OK:

‎src/apps/metadyn/MetaEd.C‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,9 @@ void MetaEd::startTheoryApp(const bool& localInitFlag)
16941694
// Create datagram socket, Let Wx select a port for us - (Service(0))
16951695
wxIPV4address bindAddress;
16961696
bindAddress.Service(0);
1697+
// Only the dialog on this machine may send: unbound, anyone on the
1698+
// network could set this editor's values.
1699+
bindAddress.LocalHost();
16971700
p_theoryInSocket = new wxDatagramSocket(bindAddress);
16981701

16991702
// Check state of new socket, if its OK:
@@ -1781,6 +1784,9 @@ void MetaEd::startRuntypeApp(const bool& localInitFlag)
17811784
// Create datagram socket, Let Wx select a port for us - (Service(0))
17821785
wxIPV4address bindAddress;
17831786
bindAddress.Service(0);
1787+
// Only the dialog on this machine may send: unbound, anyone on the
1788+
// network could set this editor's values.
1789+
bindAddress.LocalHost();
17841790
p_runtypeInSocket = new wxDatagramSocket(bindAddress);
17851791

17861792
// Check state of new socket, if its OK:

‎src/wxgui/wxdialogs/WxDavAuth.C‎

Lines changed: 4 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,10 @@ bool WxDavAuth::prompt(const string& strurl,
383383
wxMax(before.GetHeight(), after.GetHeight())));
384384
}
385385

386-
authDlg.showChangeBtn(true);
386+
// No password change or account creation from here: there is no
387+
// server side for them, and the request put both passwords in the
388+
// URL, which the data server writes to its access log.
389+
authDlg.showChangeBtn(false);
387390
authDlg.setServer(url.getHost());
388391
authDlg.setProtocol("http");
389392
// Prefilling the session user's own name here would invite retyping
@@ -414,43 +417,6 @@ bool WxDavAuth::prompt(const string& strurl,
414417
ret = true;
415418
user = authDlg.getUser();
416419
password = authDlg.getPassword();
417-
string newPassword = authDlg.getNewPassword();
418-
419-
if (newUser) {
420-
if (password.length() >= 6) {
421-
ret = createNewUser(strurl, user, password);
422-
} else {
423-
done = false;
424-
ewxMessageDialog dlg(NULL,
425-
"Unable to create new data server account.\n"
426-
"Password must be at least 6 characters.",
427-
"Create Data Server Account Failed",
428-
wxOK|wxICON_EXCLAMATION|wxSTAY_ON_TOP,
429-
wxDefaultPosition);
430-
dlg.ShowModal();
431-
authDlg.setPassword("");
432-
}
433-
} else if (newPassword != "") {
434-
if (newPassword.length() >= 6) {
435-
done = false;
436-
ret = changePassword(strurl, user, password, newPassword);
437-
if (ret) {
438-
done = true;
439-
// if the change succeeded, new password must be used
440-
password = newPassword;
441-
}
442-
} else {
443-
done = false;
444-
ewxMessageDialog dlg(NULL,
445-
"Unable to change your data server password.\n"
446-
"New password must be at least 6 characters.",
447-
"Change Data Server Password Failed",
448-
wxOK|wxICON_EXCLAMATION|wxSTAY_ON_TOP,
449-
wxDefaultPosition);
450-
dlg.ShowModal();
451-
authDlg.setNewPassword("");
452-
}
453-
}
454420
}
455421
}
456422

@@ -466,80 +432,6 @@ bool WxDavAuth::prompt(const string& strurl,
466432
}
467433

468434

469-
470-
bool WxDavAuth::createNewUser(const string& strurl, const string& user,
471-
const string& password)
472-
{
473-
bool ret = false;
474-
475-
string urlbase = strurl;
476-
string::size_type pos = urlbase.rfind("/");
477-
if (pos != string::npos)
478-
urlbase.replace(pos+1, urlbase.length()-pos-1, "");
479-
480-
string urlcgi = urlbase + "cgi-bin/ecce_accounts?parama=create&paramu=";
481-
string urlstr = urlcgi + user + "&paramr=Ecce-";
482-
483-
string realm = EDSIServerCentral::readRealm();
484-
urlstr += realm;
485-
486-
urlstr += "&paramn=" + password;
487-
488-
EcceDAVClient edcCreate(urlstr);
489-
ostrstream ostr;
490-
ret = edcCreate.doPost(ostr) == 200;
491-
if (ret) {
492-
// just in case they already have this user,url cached even
493-
// though it is a new user
494-
AuthCache::getCache().changePass(urlbase, user, password);
495-
} else {
496-
string msg = "Unable to create new data server account.\n"
497-
"Contact your site ECCE administrator.";
498-
ewxMessageDialog dlg(NULL, msg.c_str(),
499-
"Create Data Server Account Failed",
500-
wxOK|wxICON_EXCLAMATION|wxSTAY_ON_TOP,
501-
wxDefaultPosition);
502-
dlg.ShowModal();
503-
}
504-
505-
return ret;
506-
}
507-
508-
509-
510-
bool WxDavAuth::changePassword(const string& strurl, const string& user,
511-
const string& password,const string& newPassword)
512-
{
513-
bool ret = false;
514-
515-
string urlbase = strurl;
516-
string::size_type pos = urlbase.rfind("/");
517-
if (pos != string::npos)
518-
urlbase.replace(pos+1, urlbase.length()-pos-1, "");
519-
520-
string urlcgi = urlbase + "cgi-bin/ecce_accounts?parama=modify&paramu=";
521-
string urlstr = urlcgi + user + "&paramo=" + password;
522-
urlstr += "&paramn=" + newPassword;
523-
524-
EcceDAVClient edcModify(urlstr);
525-
ostrstream mostr;
526-
ret = edcModify.doPost(mostr) == 200;
527-
if (ret) {
528-
AuthCache::getCache().changePass(urlbase, user, newPassword);
529-
} else {
530-
ewxMessageDialog dlg(NULL,
531-
"Unable to change your data server password.\n"
532-
"Current password may be incorrect.",
533-
"Change Data Server Password Failed",
534-
wxOK|wxICON_EXCLAMATION|wxSTAY_ON_TOP,
535-
wxDefaultPosition);
536-
dlg.ShowModal();
537-
}
538-
539-
return ret;
540-
}
541-
542-
543435
/**
544436
* Add to cache because it worked. The addAuthentication method is
545437
* responsible for not adding duplicates.

0 commit comments

Comments
 (0)