2 package IkiWiki::Receive;
9 my $user=(getpwuid(exists $ENV{CALLER_UID} ? $ENV{CALLER_UID} : $<))[0];
10 if (! defined $user) {
11 error("cannot determine username for $<");
18 return ! ref $config{untrusted_committers} ||
19 ! grep { $_ eq $user } @{$config{untrusted_committers}};
23 # Test for commits from untrusted committers in the wrapper, to
24 # avoid starting ikiwiki proper at all for trusted commits.
29 /* 3 characters per byte is certainly enough */
30 char uid_string[sizeof(u) * 3 + 1];
36 error(sprintf(gettext("cannot determine id of untrusted committer %s"), $_));
39 } @{$config{untrusted_committers}}).
45 * Consume all stdin before exiting, as git may
46 * otherwise be unhappy. */
48 while (read(0, &buf, 256) != 0) {}
51 snprintf(uid_string, sizeof(uid_string), "%i", u);
52 addenv("CALLER_UID", uid_string);
64 # Dummy up a cgi environment to use when calling check_canedit
70 # And dummy up a session object.
72 my $session=IkiWiki::cgi_getsession($cgi);
73 $session->param("name", getuser());
74 # Make sure whatever user was authed is in the
76 require IkiWiki::UserInfo;
77 if (! IkiWiki::userinfo_get($session->param("name"), "regdate")) {
78 IkiWiki::userinfo_setall($session->param("name"), {
82 }) || error("failed adding user");
85 IkiWiki::check_canchange(
88 changes => [IkiWiki::rcs_receive()]