Hi,
On Sat, Oct 12, 2002 at 03:03:46PM -0500, Burton M. Strauss III
wrote:
> Perhaps it should ... develop and test the patch and post
> it... probably easiest to log an error and stop at that point.
attached is a patch to make it display an error message and exit
if it is already in daemon mode and finds itself wanting to
get an admin password. My criticism of my own patch is that it
does not display the error message using the correct way (using
traceEvent); but traceEvent is non-functional when it wants
to call getpass(). In other words, the patch seems to work (in
Unix), but it's exceedingly ugly.
I tried to see if I can do it the other way, i.e., check
to see if the admin password exists before it calls
daemonize(). However, at that point the mutexes are not yet
created, and every time it would think the admin password does
not exist, even if it really does already exist.
> Or, you could read 1STRUN.TXT and follow that procedure. If
> you do, it's all done before it detaches the terminal.
--
Ambrose Li <[EMAIL PROTECTED]>
http://trends.ca/~acli/ http://www.cccgt.org/
DRM is theft - We are the stakeholders
--- admin.c.dist Thu Jul 25 11:31:32 2002
+++ admin.c Sat Oct 12 16:53:31 2002
@@ -936,6 +936,16 @@
/* If not existing, then add user 'admin' and ask for password */
if(userQuestion != NULL) {
+ if (myGlobals.daemonMode) {
+ /*
+ * We need a password for the admin user, but the user requested
+ * daemon mode. stdin is already detached, but syslog is not yet
+ * activated. So we can use neither getpass() nor traceEvent()
+ */
+ fprintf(stderr, "No password for admin user. Please re-run ntop in non-daemon
+mode first.\n");
+ exit(1);
+ }
+
memset(pw1, 0, sizeof(pw1)); memset(pw2, 0, sizeof(pw2));
while(pw1[0] == '\0') {