Gentoo Archives: gentoo-user

From: Joseph <syscon780@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] DBI connect dbname=template1 failed Permission denied
Date: Fri, 16 Dec 2011 03:19:01
Message-Id: 20111216032029.GI9747@syscon4.inet
In Reply to: Re: [gentoo-user] DBI connect dbname=template1 failed Permission denied by Pandu Poluan
1 On 12/16/11 05:49, Pandu Poluan wrote:
2 > >
3 > > Okay, according to the documentation on GRANT, "=c/postgres" means the
4 > public is granted "CONNECT" privilege, granted by the user postgres. So no
5 > problem there.
6 > >
7 > > Hmm... wonder what's wrong...
8 > >
9 >
10 > Okay, I'm grasping at straws currently... how does the offending line in
11 > admin.pl look like?
12 >
13 > Rgds,
14
15 Hi Pandu,
16
17 Thanks for helping out on this. I'm pulling my hair trying to figure it out and I'm getting nowhere.
18
19 The SQL-Ledger developer was helping me out on this and he can not figure it out either.
20 I'm sure it is not SQL-ledger as it is working perfectly on my other computers. It could be apache configuration, but I don't see how?
21 I've compared file (using meld) setup with my working server and they are the same.
22 So it could be something do to with permission. As I copied apache configuration file using "meld" and meld program does not preserve ownership.
23
24 Here is amdin.pl script from SQL-Ledger
25
26 #!/usr/bin/perl -X
27 #
28 ######################################################################
29 # SQL-Ledger ERP
30 # Copyright (C) 2006
31 #
32 # Author: DWS Systems Inc.
33 # Web: http://www.sql-ledger.com
34 #
35 #######################################################################
36 #
37 # this script sets up the terminal and runs the scripts
38 # in bin/$terminal directory
39 # admin.pl is linked to this script
40 #
41 #######################################################################
42
43
44 # setup defaults, DO NOT CHANGE
45 $userspath = "users";
46 $spool = "spool";
47 $templates = "templates";
48 $images = "images";
49 $memberfile = "users/members";
50 $sendmail = "| /usr/sbin/sendmail -t";
51 %printer = ();
52 ########## end ###########################################
53
54
55 $| = 1;
56
57 eval { require "sql-ledger.conf"; };
58
59
60 if ($ENV{CONTENT_LENGTH}) {
61 read(STDIN, $_, $ENV{CONTENT_LENGTH});
62 }
63
64 if ($ENV{QUERY_STRING}) {
65 $_ = $ENV{QUERY_STRING};
66 }
67
68 if ($ARGV[0]) {
69 $_ = $ARGV[0];
70 }
71
72
73 %form = split /[&=]/;
74
75 # fix for apache 2.0 bug
76 map { $form{$_} =~ s/\\$// } keys %form;
77
78 # name of this script
79 $0 =~ tr/\\/\//;
80 $pos = rindex $0, '/';
81 $script = substr($0, $pos + 1);
82
83 @scripts = qw(login.pl admin.pl custom_login.pl custom_admin.pl);
84
85 if (grep !/^\Q$form{script}\E/, @scripts) {
86 print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT};
87 print "\nAccess denied!\n";
88 exit;
89 }
90
91 if (-f "$userspath/nologin" && $script ne 'admin.pl') {
92 print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT};
93 if (-s "$userspath/nologin") {
94 open(FH, "$userspath/nologin");
95 $message = <FH>;
96 close(FH);
97 print "\n$message\n";
98 } else {
99 print "\nLogin disabled!\n";
100 }
101 exit;
102 }
103
104
105 if ($form{path}) {
106 $form{path} =~ s/%2f/\//gi;
107 $form{path} =~ s/\.\.//g;
108
109 if ($form{path} !~ /^bin\//) {
110 print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT};
111 print "\nInvalid path!\n";
112 exit;
113 }
114
115
116 $ARGV[0] = "$_&script=$script";
117 require "$form{path}/$script";
118 } else {
119
120 if (!$form{terminal}) {
121 if ($ENV{HTTP_USER_AGENT}) {
122 # web browser
123 $form{terminal} = "lynx";
124 if ($ENV{HTTP_USER_AGENT} !~ /lynx/i) {
125 $form{terminal} = "mozilla";
126 }
127 } else {
128 if ($ENV{TERM} =~ /xterm/) {
129 $form{terminal} = "xterm";
130 }
131 if ($ENV{TERM} =~ /(console|linux|vt.*)/i) {
132 $form{terminal} = "console";
133 }
134 }
135 }
136
137
138 if ($form{terminal}) {
139 $form{terminal} =~ s/%2f/\//gi;
140 $form{terminal} =~ s/\.\.//g;
141
142 $ARGV[0] = "path=bin/$form{terminal}&script=$script";
143 map { $ARGV[0] .= "&${_}=$form{$_}" } keys %form;
144
145 require "bin/$form{terminal}/$script";
146
147 } else {
148
149 print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT};
150 print qq|\nUnknown terminal\n|;
151 }
152
153 }
154
155 # end of main
156
157 --
158 Joseph

Replies

Subject Author
Re: [gentoo-user] DBI connect dbname=template1 failed Permission denied Stroller <stroller@××××××××××××××××××.uk>