From f5bd1cf3cd4cc481cfd0bb08ee06aded56fc32ee Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 10 Sep 2009 13:49:42 -0400 Subject: typo --- IkiWiki/Receive.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'IkiWiki/Receive.pm') diff --git a/IkiWiki/Receive.pm b/IkiWiki/Receive.pm index 37b6f2a62..31ab3a500 100644 --- a/IkiWiki/Receive.pm +++ b/IkiWiki/Receive.pm @@ -114,7 +114,7 @@ sub test () { # by not testing the removal in such pairs of changes. # (The add is still tested, just to make sure that # no data is added to the repo that a web edit - # could add.) + # could not add.) next if $newfiles{$file}; if (IkiWiki::Plugin::remove->can("check_canremove")) { -- cgit v1.2.3 From 26dae8f04955915f4203fab4bd5301c959f7771a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 10 Sep 2009 16:09:19 -0400 Subject: clean up use of IkiWiki::Receive Loading and use of IkiWiki::Receive can all be pushed into the git plugin, rather than scattered around. I had at first wanted to make a receive plugin and move it there, but a plugin was not a good fit; you don't want users to have to manually load it, and making the git plugin load the receive plugin at the right times would need more, and ugly code. --- IkiWiki/Plugin/git.pm | 19 +++++++++++++++++++ IkiWiki/Receive.pm | 7 ++++--- IkiWiki/Wrapper.pm | 4 ---- ikiwiki.in | 4 ---- 4 files changed, 23 insertions(+), 11 deletions(-) (limited to 'IkiWiki/Receive.pm') diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 68b114a73..ad58231e0 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -14,6 +14,7 @@ my $no_chdir=0; sub import { hook(type => "checkconfig", id => "git", call => \&checkconfig); hook(type => "getsetup", id => "git", call => \&getsetup); + hook(type => "genwrapper", id => "git", call => \&genwrapper); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); hook(type => "rcs", id => "rcs_prepedit", call => \&rcs_prepedit); hook(type => "rcs", id => "rcs_commit", call => \&rcs_commit); @@ -41,6 +42,7 @@ sub checkconfig () { wrappermode => (defined $config{git_wrappermode} ? $config{git_wrappermode} : "06755"), }; } + if (defined $config{git_test_receive_wrapper} && length $config{git_test_receive_wrapper}) { push @{$config{wrappers}}, { @@ -49,6 +51,13 @@ sub checkconfig () { wrappermode => (defined $config{git_wrappermode} ? $config{git_wrappermode} : "06755"), }; } + + # Run receive test only if being called by the wrapper, and not + # when generating same. + if ($config{test_receive} && ! exists $config{wrapper}) { + require IkiWiki::Receive; + IkiWiki::Receive::test(); + } } sub getsetup () { @@ -115,6 +124,16 @@ sub getsetup () { }, } +sub genwrapper { + if ($config{test_receive}) { + require IkiWiki::Receive; + return IkiWiki::Receive::genwrapper(); + } + else { + return ""; + } +} + sub safe_git (&@) { # Start a child process safely without resorting /bin/sh. # Return command output or success state (in scalar context). diff --git a/IkiWiki/Receive.pm b/IkiWiki/Receive.pm index 37b6f2a62..101c13ee5 100644 --- a/IkiWiki/Receive.pm +++ b/IkiWiki/Receive.pm @@ -1,5 +1,4 @@ #!/usr/bin/perl - package IkiWiki::Receive; use warnings; @@ -20,9 +19,9 @@ sub trusted () { ! grep { $_ eq $user } @{$config{untrusted_committers}}; } -sub gen_wrapper () { +sub genwrapper () { # Test for commits from untrusted committers in the wrapper, to - # avoid loading ikiwiki at all for trusted commits. + # avoid starting ikiwiki proper at all for trusted commits. my $ret=<<"EOF"; { @@ -37,6 +36,8 @@ EOF "u != $uid"; } @{$config{untrusted_committers}}). ") exit(0);\n"; + + $ret.=<<"EOF"; asprintf(&s, "CALLER_UID=%i", u); newenviron[i++]=s; diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index cf85738d6..ff110b5ff 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -37,10 +37,6 @@ sub gen_wrapper () { addenv("$var", s); EOF } - - if ($config{test_receive}) { - require IkiWiki::Receive; - } my @wrapper_hooks; run_hooks(genwrapper => sub { push @wrapper_hooks, shift->() }); diff --git a/ikiwiki.in b/ikiwiki.in index 4e9b812f8..b8581d880 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -190,10 +190,6 @@ sub main () { elsif ($config{post_commit} && ! commit_hook_enabled()) { # do nothing } - elsif ($config{test_receive}) { - require IkiWiki::Receive; - IkiWiki::Receive::test(); - } else { if ($config{rebuild}) { debug(gettext("rebuilding wiki..")); -- cgit v1.2.3 From a97964688b73d0a3237c798dce3fb064ff29ff11 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 19:05:40 -0400 Subject: unfinished file_prune revamp Many calls to file_prune were incorrectly calling it with 2 parameters. In cases where the filename being checked is relative to the srcdir, that is not needed. Made absolute filenames be pruned. (This won't work for the 2 parameter call style.) --- IkiWiki.pm | 2 +- IkiWiki/Plugin/attachment.pm | 2 +- IkiWiki/Plugin/comments.pm | 4 ++-- IkiWiki/Plugin/editpage.pm | 4 ++-- IkiWiki/Plugin/rename.pm | 5 ++--- IkiWiki/Receive.pm | 2 +- t/file_pruned.t | 40 +++++++++++++++++++++++++++++++++++++--- 7 files changed, 46 insertions(+), 13 deletions(-) (limited to 'IkiWiki/Receive.pm') diff --git a/IkiWiki.pm b/IkiWiki.pm index b37b1f344..a5f83ac7a 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -355,7 +355,7 @@ sub getsetup () { }, wiki_file_prune_regexps => { type => "internal", - default => [qr/(^|\/)\.\.(\/|$)/, qr/^\./, qr/\/\./, + default => [qr/(^|\/)\.\.(\/|$)/, qr/^\//, qr/^\./, qr/\/\./, qr/\.x?html?$/, qr/\.ikiwiki-new$/, qr/(^|\/).svn\//, qr/.arch-ids\//, qr/{arch}\//, qr/(^|\/)_MTN\//, qr/(^|\/)_darcs\//, diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index ad1dd9bca..8c3ff887a 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -137,7 +137,7 @@ sub formbuilder (@) { $filename=linkpage(IkiWiki::possibly_foolish_untaint( attachment_location($form->field('page')). IkiWiki::basename($filename))); - if (IkiWiki::file_pruned($filename, $config{srcdir})) { + if (IkiWiki::file_pruned($filename)) { error(gettext("bad attachment filename")); } diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 0aa043215..1c219b6c6 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -338,7 +338,7 @@ sub editcomment ($$) { my $page = $form->field('page'); $page = IkiWiki::possibly_foolish_untaint($page); if (! defined $page || ! length $page || - IkiWiki::file_pruned($page, $config{srcdir})) { + IkiWiki::file_pruned($page)) { error(gettext("bad page name")); } @@ -548,7 +548,7 @@ sub commentmoderation ($$) { # pending comment before untainting. my ($f)= $id =~ /$config{wiki_file_regexp}/; if (! defined $f || ! length $f || - IkiWiki::file_pruned($f, $config{srcdir})) { + IkiWiki::file_pruned($f)) { error("illegal file"); } diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 44fe5514a..ee1de8eaa 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -94,7 +94,7 @@ sub cgi_editpage ($$) { $page=possibly_foolish_untaint($page); my $absolute=($page =~ s#^/+##); if (! defined $page || ! length $page || - file_pruned($page, $config{srcdir})) { + file_pruned($page)) { error(gettext("bad page name")); } @@ -220,7 +220,7 @@ sub cgi_editpage ($$) { my $best_loc; if (! defined $from || ! length $from || $from ne $form->field('from') || - file_pruned($from, $config{srcdir}) || + file_pruned($from) || $from=~/^\// || $absolute || $form->submitted) { diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 1a9da6363..69e615ead 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -63,9 +63,8 @@ sub check_canrename ($$$$$$) { error(gettext("no change to the file name was specified")); } - # Must be a legal filename, and not absolute. - if (IkiWiki::file_pruned($destfile, $config{srcdir}) || - $destfile=~/^\//) { + # Must be a legal filename. + if (IkiWiki::file_pruned($destfile)) { error(sprintf(gettext("illegal name"))); } diff --git a/IkiWiki/Receive.pm b/IkiWiki/Receive.pm index cd94d0938..ae1bd8bef 100644 --- a/IkiWiki/Receive.pm +++ b/IkiWiki/Receive.pm @@ -82,7 +82,7 @@ sub test () { my ($file)=$change->{file}=~/$config{wiki_file_regexp}/; $file=IkiWiki::possibly_foolish_untaint($file); if (! defined $file || ! length $file || - IkiWiki::file_pruned($file, $config{srcdir})) { + IkiWiki::file_pruned($file)) { error(gettext("bad file name %s"), $file); } diff --git a/t/file_pruned.t b/t/file_pruned.t index f9c1c257e..4335ed917 100755 --- a/t/file_pruned.t +++ b/t/file_pruned.t @@ -1,41 +1,75 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 27; +use Test::More tests => 54; BEGIN { use_ok("IkiWiki"); } %config=IkiWiki::defaultconfig(); ok(IkiWiki::file_pruned("src/.htaccess", "src")); +ok(IkiWiki::file_pruned(".htaccess")); ok(IkiWiki::file_pruned("src/.ikiwiki/", "src")); +ok(IkiWiki::file_pruned(".ikiwiki/")); ok(IkiWiki::file_pruned("src/.ikiwiki/index", "src")); +ok(IkiWiki::file_pruned(".ikiwiki/index")); ok(IkiWiki::file_pruned("src/CVS/foo", "src")); +ok(IkiWiki::file_pruned("CVS/foo")); ok(IkiWiki::file_pruned("src/subdir/CVS/foo", "src")); +ok(IkiWiki::file_pruned("subdir/CVS/foo")); ok(IkiWiki::file_pruned("src/.svn", "src")); +ok(IkiWiki::file_pruned(".svn")); ok(IkiWiki::file_pruned("src/subdir/.svn", "src")); +ok(IkiWiki::file_pruned("subdir/.svn")); ok(IkiWiki::file_pruned("src/subdir/.svn/foo", "src")); +ok(IkiWiki::file_pruned("subdir/.svn/foo")); ok(IkiWiki::file_pruned("src/.git", "src")); +ok(IkiWiki::file_pruned(".git")); ok(IkiWiki::file_pruned("src/subdir/.git", "src")); +ok(IkiWiki::file_pruned("subdir/.git")); ok(IkiWiki::file_pruned("src/subdir/.git/foo", "src")); +ok(IkiWiki::file_pruned("subdir/.git/foo")); ok(! IkiWiki::file_pruned("src/svn/fo", "src")); +ok(! IkiWiki::file_pruned("svn/fo")); ok(! IkiWiki::file_pruned("src/git", "src")); +ok(! IkiWiki::file_pruned("git")); ok(! IkiWiki::file_pruned("src/index.mdwn", "src")); +ok(! IkiWiki::file_pruned("index.mdwn")); ok(! IkiWiki::file_pruned("src/index.", "src")); +ok(! IkiWiki::file_pruned("index.")); # these are ok because while the filename starts with ".", the canonpathed # version does not ok(! IkiWiki::file_pruned("src/.", "src")); ok(! IkiWiki::file_pruned("src/./", "src")); +# OTOH, without a srcdir, no canonpath, so they're not allowed. +ok(IkiWiki::file_pruned(".")); +ok(IkiWiki::file_pruned("./")); + +# Without a srcdir, absolute filenames are not allowed. +ok(IkiWiki::file_pruned("/etc/passwd")); +ok(IkiWiki::file_pruned("//etc/passwd")); +ok(IkiWiki::file_pruned("/")); +ok(IkiWiki::file_pruned("//")); +ok(IkiWiki::file_pruned("///")); + ok(IkiWiki::file_pruned("src/..", "src")); +ok(IkiWiki::file_pruned("..")); ok(IkiWiki::file_pruned("src/../", "src")); +ok(IkiWiki::file_pruned("../")); ok(IkiWiki::file_pruned("src/../", "src")); +ok(IkiWiki::file_pruned("../")); +# This is perhaps counterintuitive. ok(! IkiWiki::file_pruned("src", "src")); + +# Dots, etc, in the srcdir are ok. ok(! IkiWiki::file_pruned("/.foo/src", "/.foo/src")); ok(IkiWiki::file_pruned("/.foo/src/.foo/src", "/.foo/src")); ok(! IkiWiki::file_pruned("/.foo/src/index.mdwn", "/.foo/src/index.mdwn")); -ok(IkiWiki::file_pruned("x/y/foo.dpkg-tmp", "src")); -ok(IkiWiki::file_pruned("x/y/foo.ikiwiki-new", "src")); +ok(IkiWiki::file_pruned("src/y/foo.dpkg-tmp", "src")); +ok(IkiWiki::file_pruned("y/foo.dpkg-tmp")); +ok(IkiWiki::file_pruned("src/y/foo.ikiwiki-new", "src")); +ok(IkiWiki::file_pruned("y/foo.ikiwiki-new")); -- cgit v1.2.3 From 4292802ee5f93f7ec7644c5d0a30f7ffeb95e566 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 23 Jun 2010 16:32:20 -0400 Subject: stop using REMOTE_ADDR Everywhere that REMOTE_ADDR was used, a session object is available, so instead use its remote_addr method. In IkiWiki::Receive, stop setting a dummy REMOTE_ADDR. Note that it's possible for a session cookie to be obtained using one IP address, and then used from another IP. In this case, the first IP will now be used. I think that should be ok. --- IkiWiki/CGI.pm | 2 +- IkiWiki/Plugin/attachment.pm | 5 +++-- IkiWiki/Plugin/blogspam.pm | 3 ++- IkiWiki/Plugin/comments.pm | 10 ++++++---- IkiWiki/Plugin/editpage.pm | 3 ++- IkiWiki/Plugin/lockedit.pm | 2 +- IkiWiki/Plugin/moderatedcomments.pm | 4 ++-- IkiWiki/Plugin/passwordauth.pm | 2 +- IkiWiki/Plugin/poll.pm | 3 ++- IkiWiki/Plugin/remove.pm | 3 ++- IkiWiki/Plugin/rename.pm | 8 +++++--- IkiWiki/Receive.pm | 1 - 12 files changed, 27 insertions(+), 19 deletions(-) (limited to 'IkiWiki/Receive.pm') diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 28020b500..f2a32a958 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -283,7 +283,7 @@ sub check_banned ($$) { foreach my $b (@{$config{banned_users}}) { if (pagespec_match("", $b, - ip => $ENV{REMOTE_ADDR}, + ip => $session->remote_addr(), name => defined $name ? $name : "", )) { $banned=1; diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index ce688ca40..216e00b3d 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -58,7 +58,7 @@ sub check_canattach ($$;$) { $config{allowed_attachments}, file => $file, user => $session->param("name"), - ip => $ENV{REMOTE_ADDR}, + ip => $session->remote_addr(), ); } @@ -185,7 +185,8 @@ sub formbuilder (@) { IkiWiki::disable_commit_hook(); IkiWiki::rcs_commit($filename, gettext("attachment upload"), IkiWiki::rcs_prepedit($filename), - $session->param("name"), $ENV{REMOTE_ADDR}); + $session->param("name"), + $session->remote_addr()); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm index c4e5cf390..8db3780e8 100644 --- a/IkiWiki/Plugin/blogspam.pm +++ b/IkiWiki/Plugin/blogspam.pm @@ -58,6 +58,7 @@ sub checkconfig () { sub checkcontent (@) { my %params=@_; + my $session=$params{session}; if (exists $config{blogspam_pagespec}) { return undef @@ -88,7 +89,7 @@ sub checkcontent (@) { push @options, "exclude=stopwords"; my %req=( - ip => $ENV{REMOTE_ADDR}, + ip => $session->remote_addr(), comment => defined $params{diff} ? $params{diff} : $params{content}, subject => defined $params{subject} ? $params{subject} : "", name => defined $params{author} ? $params{author} : "", diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index d1558001a..4770209c9 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -402,8 +402,8 @@ sub editcomment ($$) { $username =~ s/"/"/g; $content .= " username=\"$username\"\n"; } - elsif (defined $ENV{REMOTE_ADDR}) { - my $ip = $ENV{REMOTE_ADDR}; + elsif (defined $session->remote_addr()) { + my $ip = $session->remote_addr(); if ($ip =~ m/^([.0-9]+)$/) { $content .= " ip=\"$1\"\n"; } @@ -514,7 +514,8 @@ sub editcomment ($$) { IkiWiki::rcs_add($file); IkiWiki::disable_commit_hook(); $conflict = IkiWiki::rcs_commit_staged($message, - $session->param('name'), $ENV{REMOTE_ADDR}); + $session->param('name'), + $session->remote_addr()); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } @@ -603,7 +604,8 @@ sub commentmoderation ($$) { my $message = gettext("Comment moderation"); IkiWiki::disable_commit_hook(); $conflict=IkiWiki::rcs_commit_staged($message, - $session->param('name'), $ENV{REMOTE_ADDR}); + $session->param('name'), + $session->remote_addr()); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 3ba6c519e..a8e75121f 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -403,7 +403,8 @@ sub cgi_editpage ($$) { disable_commit_hook(); $conflict=rcs_commit($file, $message, $form->field("rcsinfo"), - $session->param("name"), $ENV{REMOTE_ADDR}); + $session->param("name"), + $session->remote_addr()); enable_commit_hook(); rcs_update(); } diff --git a/IkiWiki/Plugin/lockedit.pm b/IkiWiki/Plugin/lockedit.pm index 1466e8337..5b50fd115 100644 --- a/IkiWiki/Plugin/lockedit.pm +++ b/IkiWiki/Plugin/lockedit.pm @@ -38,7 +38,7 @@ sub canedit ($$) { if (defined $config{locked_pages} && length $config{locked_pages} && pagespec_match($page, $config{locked_pages}, user => $session->param("name"), - ip => $ENV{REMOTE_ADDR}, + ip => $session->remote_addr(), )) { if ((! defined $user || ! IkiWiki::userinfo_get($session->param("name"), "regdate")) && diff --git a/IkiWiki/Plugin/moderatedcomments.pm b/IkiWiki/Plugin/moderatedcomments.pm index ff2c2b160..5957833fc 100644 --- a/IkiWiki/Plugin/moderatedcomments.pm +++ b/IkiWiki/Plugin/moderatedcomments.pm @@ -48,11 +48,11 @@ sub checkcontent (@) { } my $session=$params{session}; - my $user=$session->param("name") if $session; + my $user=$session->param("name"); if (pagespec_match($params{page}, $config{moderate_pagespec}, location => $params{page}, (defined $user ? (user => $user) : ()), - (defined $ENV{REMOTE_ADDR} ? (ip => $ENV{REMOTE_ADDR}) : ()), + (defined $session->remote_addr() ? (ip => $session->remote_addr()) : ()), )) { return gettext("comment needs moderation"); } diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm index baddca093..35ebd961f 100644 --- a/IkiWiki/Plugin/passwordauth.pm +++ b/IkiWiki/Plugin/passwordauth.pm @@ -297,7 +297,7 @@ sub formbuilder (@) { ), wikiurl => $config{url}, wikiname => $config{wikiname}, - REMOTE_ADDR => $ENV{REMOTE_ADDR}, + remote_addr => $session->remote_addr(), ); eval q{use Mail::Sendmail}; diff --git a/IkiWiki/Plugin/poll.pm b/IkiWiki/Plugin/poll.pm index 6bc4579c2..e50efa5e0 100644 --- a/IkiWiki/Plugin/poll.pm +++ b/IkiWiki/Plugin/poll.pm @@ -136,7 +136,8 @@ sub sessioncgi ($$) { IkiWiki::disable_commit_hook(); IkiWiki::rcs_commit($pagesources{$page}, "poll vote ($choice)", IkiWiki::rcs_prepedit($pagesources{$page}), - $session->param("name"), $ENV{REMOTE_ADDR}); + $session->param("name"), + $session->remote_addr()); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index d23b2cc10..b664cbf74 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -214,7 +214,8 @@ sub sessioncgi ($$) { IkiWiki::rcs_remove($file); } IkiWiki::rcs_commit_staged(gettext("removed"), - $session->param("name"), $ENV{REMOTE_ADDR}); + $session->param("name"), + $session->remote_addr()); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 0da90a538..977c09e67 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -350,7 +350,9 @@ sub sessioncgi ($$) { } IkiWiki::rcs_commit_staged( sprintf(gettext("rename %s to %s"), $srcfile, $destfile), - $session->param("name"), $ENV{REMOTE_ADDR}) if $config{rcs}; + $session->param("name"), + $session->remote_addr(), + ) if $config{rcs}; # Then link fixups. foreach my $rename (@torename) { @@ -575,8 +577,8 @@ sub fixlinks ($$$) { $file, sprintf(gettext("update for rename of %s to %s"), $rename->{srcfile}, $rename->{destfile}), $token, - $session->param("name"), - $ENV{REMOTE_ADDR} + $session->param("name"), + $session->remote_addr(), ); push @fixedlinks, $page if ! defined $conflict; } diff --git a/IkiWiki/Receive.pm b/IkiWiki/Receive.pm index ae1bd8bef..fdd463025 100644 --- a/IkiWiki/Receive.pm +++ b/IkiWiki/Receive.pm @@ -57,7 +57,6 @@ sub test () { eval q{use CGI}; error($@) if $@; my $cgi=CGI->new; - $ENV{REMOTE_ADDR}='unknown' unless exists $ENV{REMOTE_ADDR}; # And dummy up a session object. require IkiWiki::CGI; -- cgit v1.2.3