~ubuntu-branches/ubuntu/edgy/bugzilla/edgy

« back to all changes in this revision

Viewing changes to sidebar.cgi

  • Committer: Bazaar Package Importer
  • Author(s): Alexis Sukrieh
  • Date: 2005-10-03 16:51:01 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051003165101-38n0y5qofd68vole
Tags: 2.18.4-1
* New upstream minor release
  + Fixed a security issue: It was possible to bypass the "user
    visibility groups" restrictions if user-matching was turned on
    in "substring" mode.
  + Fixed a security issue: config.cgi exposed information to users who
    weren't logged in, even when "requirelogin" was turned on in Bugzilla.
  (closes: #331206)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bonsaitools/bin/perl -wT
 
1
#!/usr/bin/perl -wT
2
2
# -*- Mode: perl; indent-tabs-mode: nil -*-
3
3
#
4
4
# The contents of this file are subject to the Mozilla Public
13
13
#
14
14
# The Original Code is the Bugzilla Bug Tracking System.
15
15
#
16
 
# Contributor(s): Jacob Steenhagen <jake@acutex.net>
 
16
# Contributor(s): Jacob Steenhagen <jake@bugzilla.org>
17
17
 
18
18
use strict;
19
 
use diagnostics;
20
19
 
21
 
use lib "/usr/share/bugzilla/lib";
 
20
use lib ".";
22
21
require "CGI.pl";
23
22
 
24
23
# Shut up "Used Only Once" errors
27
26
  $vars
28
27
);
29
28
 
30
 
ConnectToDatabase();
31
 
quietly_check_login();
 
29
Bugzilla->login();
 
30
 
 
31
my $cgi = Bugzilla->cgi;
32
32
 
33
33
###############################################################################
34
34
# Main Body Execution
35
35
###############################################################################
36
36
 
37
 
$vars->{'username'} = $::COOKIE{'Bugzilla_login'} || '';
38
 
 
39
 
if (defined $::COOKIE{'Bugzilla_login'}) {
40
 
    SendSQL("SELECT mybugslink, userid, blessgroupset FROM profiles " .
41
 
            "WHERE login_name = " . SqlQuote($::COOKIE{'Bugzilla_login'}));
42
 
    my ($mybugslink, $userid, $blessgroupset) = (FetchSQLData());
43
 
    $vars->{'userid'} = $userid;
44
 
    $vars->{'blessgroupset'} = $blessgroupset;
45
 
    if ($mybugslink) {
46
 
        my $mybugstemplate = Param("mybugstemplate");
47
 
        my %substs = ( 'userid' => url_quote($::COOKIE{'Bugzilla_login'}) );
48
 
        $vars->{'mybugsurl'} = PerformSubsts($mybugstemplate, \%substs);
49
 
    }
50
 
    SendSQL("SELECT name FROM namedqueries WHERE userid = $userid AND linkinfooter");
51
 
    while (MoreSQLData()) {
52
 
        my ($name) = FetchSQLData();
53
 
        push(@{$vars->{'namedqueries'}}, $name);
54
 
    }
55
 
}
56
 
 
57
37
# This sidebar is currently for use with Mozilla based web browsers.
58
38
# Internet Explorer 6 is supposed to have a similar feature, but it
59
39
# most likely won't support XUL ;)  When that does come out, this
64
44
 
65
45
my $useragent = $ENV{HTTP_USER_AGENT};
66
46
if ($useragent =~ m:Mozilla/([1-9][0-9]*):i && $1 >= 5 && $useragent !~ m/compatible/i) {
67
 
    print "Content-type: application/vnd.mozilla.xul+xml\n\n";
 
47
    print $cgi->header("application/vnd.mozilla.xul+xml");
68
48
    # Generate and return the XUL from the appropriate template.
69
49
    $template->process("sidebar.xul.tmpl", $vars)
70
50
      || ThrowTemplateError($template->error());
71
51
} else {
72
 
    DisplayError("sidebar.cgi currently only supports Mozilla based web browsers");
73
 
    exit;
 
52
    ThrowUserError("sidebar_supports_mozilla_only");
74
53
}
75
 
 
76
 
 
77