Permalink
Browse files

revert changes to logger creation - dropping privs post start will pr…

…obably remain broken now
  • Loading branch information...
1 parent a24d7bb commit e55207ada42faa7965a248f98d823f7edc36a62d @ripienaar committed Apr 5, 2012
Showing with 9 additions and 12 deletions.
  1. +9 −12 flashpolicyd.rb
View
@@ -124,6 +124,13 @@
end
}
+begin
+ @logger = Logger.new(File.expand_path(logfile), 10, 102400)
+rescue Exception => e
+ puts("Got #{e.class} #{e} while attempting to create logfile #{logfile}")
+ exit
+end
+
# Read the xml data into a string
if (xmlfile.length > 0 and File.exists?(xmlfile))
begin
@@ -408,6 +415,8 @@ def sec2dhms(secs)
# every @logfreq seconds, any exceptions gets logged and exits the server
run_server do
begin
+ @logger.info("Starting server on port #{@port} in process #{$$}")
+
server = PolicyServer.new(@port, "0.0.0.0", @xmldata, @logger, @timeout, @verbose)
server.start
@@ -422,18 +431,6 @@ def sec2dhms(secs)
Process::UID.change_privilege(uid)
end
- # create a logger keeping 10 files of 1MB each, do this after opening the socket
- # and dropping privs so that rotation wont die when the initial opened logfile as
- # root can not be rotated by the new user
- begin
- @logger = Logger.new(File.expand_path(logfile), 10, 102400)
- rescue Exception => e
- puts("Got #{e.class} #{e} while attempting to create logfile #{logfile}")
- exit
- end
-
- @logger.info("Starting server on port #{@port} in process #{$$}")
-
# Send HUP to toggle debug mode or not for a running server
trap("HUP") {
server.toggledebug

1 comment on commit e55207a

Contributor

HiddenKn commented on e55207a Apr 5, 2012

Seems to work perfectly :D

Please sign in to comment.