projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
random nits for grandstream provisioning :UI, docs, java path, s/system/IPC::Run...
[freeside.git]
/
FS
/
FS
/
InitHandler.pm
diff --git
a/FS/FS/InitHandler.pm
b/FS/FS/InitHandler.pm
index
9a2154a
..
5038cf3
100644
(file)
--- a/
FS/FS/InitHandler.pm
+++ b/
FS/FS/InitHandler.pm
@@
-1,12
+1,17
@@
package FS::InitHandler;
package FS::InitHandler;
+# this leaks memory under graceful restarts and i wouldn't use it on any
+# modern server. useful for very slow machines with memory to spare, just
+# always do a full restart
+
use strict;
use strict;
+use vars qw($DEBUG);
use FS::UID qw(adminsuidsetup);
use FS::Record;
use FS::UID qw(adminsuidsetup);
use FS::Record;
-sub handler {
+$DEBUG = 1;
-=pod
+sub handler {
use Date::Format;
use Date::Parse;
use Date::Format;
use Date::Parse;
@@
-14,7
+19,7
@@
sub handler {
use HTML::Entities;
use IO::Handle;
use IO::File;
use HTML::Entities;
use IO::Handle;
use IO::File;
- use String::Approx
:
+ use String::Approx
;
use HTML::Widgets::SelectLayers 0.02;
#use FS::UID;
#use FS::Record;
use HTML::Widgets::SelectLayers 0.02;
#use FS::UID;
#use FS::Record;
@@
-42,12
+47,11
@@
sub handler {
use FS::part_svc;
use FS::pkg_svc;
use FS::port;
use FS::part_svc;
use FS::pkg_svc;
use FS::port;
- use FS::queue
qw(joblisting)
;
+ use FS::queue;
use FS::raddb;
use FS::session;
use FS::svc_acct;
use FS::raddb;
use FS::session;
use FS::svc_acct;
- use FS::svc_acct_pop qw(popselector);
- use FS::svc_acct_sm;
+ use FS::svc_acct_pop;
use FS::svc_domain;
use FS::svc_forward;
use FS::svc_www;
use FS::svc_domain;
use FS::svc_forward;
use FS::svc_www;
@@
-57,19
+61,31
@@
sub handler {
use FS::export_svc;
use FS::msgcat;
use FS::export_svc;
use FS::msgcat;
-=cut
+ warn "[FS::InitHandler] handler called\n" if $DEBUG;
+
+ #this is sure to be broken on freebsd
+ $> = $FS::UID::freeside_uid;
open(MAPSECRETS,"<$FS::UID::conf_dir/mapsecrets")
or die "can't read $FS::UID::conf_dir/mapsecrets: $!";
open(MAPSECRETS,"<$FS::UID::conf_dir/mapsecrets")
or die "can't read $FS::UID::conf_dir/mapsecrets: $!";
+ my %seen;
while (<MAPSECRETS>) {
while (<MAPSECRETS>) {
- /^([\w\-\.]+)\s/ or do { warn "strange line in mapsecrets: $_"; next; };
- my $user = $1;
+ next if /^\s*(#|$)/;
+ /^([\w\-\.]+)\s(.*)$/
+ or do { warn "strange line in mapsecrets: $_"; next; };
+ my($user, $datasrc) = ($1, $2);
+ next if $seen{$datasrc}++;
+ warn "[FS::InitHandler] preloading $datasrc for $user\n" if $DEBUG;
adminsuidsetup($user);
}
close MAPSECRETS;
adminsuidsetup($user);
}
close MAPSECRETS;
+ #lalala probably broken on freebsd
+ ($<, $>) = ($>, $<);
+ $< = 0;
+
}
1;
}
1;