mirror of
https://github.com/go-gitea/gitea
synced 2024-08-18 08:15:10 +02:00
* Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
230 lines
7.9 KiB
Bash
230 lines
7.9 KiB
Bash
#!/usr/bin/env bash
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style
|
|
# license that can be found in the LICENSE file.
|
|
|
|
# This script runs or (given -n) prints suggested commands to generate files for
|
|
# the Architecture/OS specified by the GOARCH and GOOS environment variables.
|
|
# See README.md for more information about how the build system works.
|
|
|
|
GOOSARCH="${GOOS}_${GOARCH}"
|
|
|
|
# defaults
|
|
mksyscall="go run mksyscall.go"
|
|
mkerrors="./mkerrors.sh"
|
|
zerrors="zerrors_$GOOSARCH.go"
|
|
mksysctl=""
|
|
zsysctl="zsysctl_$GOOSARCH.go"
|
|
mksysnum=
|
|
mktypes=
|
|
mkasm=
|
|
run="sh"
|
|
cmd=""
|
|
|
|
case "$1" in
|
|
-syscalls)
|
|
for i in zsyscall*go
|
|
do
|
|
# Run the command line that appears in the first line
|
|
# of the generated file to regenerate it.
|
|
sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
|
|
rm _$i
|
|
done
|
|
exit 0
|
|
;;
|
|
-n)
|
|
run="cat"
|
|
cmd="echo"
|
|
shift
|
|
esac
|
|
|
|
case "$#" in
|
|
0)
|
|
;;
|
|
*)
|
|
echo 'usage: mkall.sh [-n]' 1>&2
|
|
exit 2
|
|
esac
|
|
|
|
if [[ "$GOOS" = "linux" ]]; then
|
|
# Use the Docker-based build system
|
|
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
|
$cmd docker build --tag generate:$GOOS $GOOS
|
|
$cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
|
|
exit
|
|
fi
|
|
|
|
GOOSARCH_in=syscall_$GOOSARCH.go
|
|
case "$GOOSARCH" in
|
|
_* | *_ | _)
|
|
echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
|
|
exit 1
|
|
;;
|
|
aix_ppc)
|
|
mkerrors="$mkerrors -maix32"
|
|
mksyscall="go run mksyscall_aix_ppc.go -aix"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
aix_ppc64)
|
|
mkerrors="$mkerrors -maix64"
|
|
mksyscall="go run mksyscall_aix_ppc64.go -aix"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
darwin_386)
|
|
mkerrors="$mkerrors -m32"
|
|
mksyscall="go run mksyscall.go -l32"
|
|
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
mkasm="go run mkasm_darwin.go"
|
|
;;
|
|
darwin_amd64)
|
|
mkerrors="$mkerrors -m64"
|
|
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
mkasm="go run mkasm_darwin.go"
|
|
;;
|
|
darwin_arm)
|
|
mkerrors="$mkerrors"
|
|
mksyscall="go run mksyscall.go -l32"
|
|
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
mkasm="go run mkasm_darwin.go"
|
|
;;
|
|
darwin_arm64)
|
|
mkerrors="$mkerrors -m64"
|
|
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
mkasm="go run mkasm_darwin.go"
|
|
;;
|
|
dragonfly_amd64)
|
|
mkerrors="$mkerrors -m64"
|
|
mksyscall="go run mksyscall.go -dragonfly"
|
|
mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
freebsd_386)
|
|
mkerrors="$mkerrors -m32"
|
|
mksyscall="go run mksyscall.go -l32"
|
|
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
freebsd_amd64)
|
|
mkerrors="$mkerrors -m64"
|
|
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
freebsd_arm)
|
|
mkerrors="$mkerrors"
|
|
mksyscall="go run mksyscall.go -l32 -arm"
|
|
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
|
|
# Let the type of C char be signed for making the bare syscall
|
|
# API consistent across platforms.
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
|
;;
|
|
freebsd_arm64)
|
|
mkerrors="$mkerrors -m64"
|
|
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
netbsd_386)
|
|
mkerrors="$mkerrors -m32"
|
|
mksyscall="go run mksyscall.go -l32 -netbsd"
|
|
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
netbsd_amd64)
|
|
mkerrors="$mkerrors -m64"
|
|
mksyscall="go run mksyscall.go -netbsd"
|
|
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
netbsd_arm)
|
|
mkerrors="$mkerrors"
|
|
mksyscall="go run mksyscall.go -l32 -netbsd -arm"
|
|
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
|
# Let the type of C char be signed for making the bare syscall
|
|
# API consistent across platforms.
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
|
;;
|
|
netbsd_arm64)
|
|
mkerrors="$mkerrors -m64"
|
|
mksyscall="go run mksyscall.go -netbsd"
|
|
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
openbsd_386)
|
|
mkerrors="$mkerrors -m32"
|
|
mksyscall="go run mksyscall.go -l32 -openbsd"
|
|
mksysctl="go run mksysctl_openbsd.go"
|
|
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
openbsd_amd64)
|
|
mkerrors="$mkerrors -m64"
|
|
mksyscall="go run mksyscall.go -openbsd"
|
|
mksysctl="go run mksysctl_openbsd.go"
|
|
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
openbsd_arm)
|
|
mkerrors="$mkerrors"
|
|
mksyscall="go run mksyscall.go -l32 -openbsd -arm"
|
|
mksysctl="go run mksysctl_openbsd.go"
|
|
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
|
# Let the type of C char be signed for making the bare syscall
|
|
# API consistent across platforms.
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
|
;;
|
|
openbsd_arm64)
|
|
mkerrors="$mkerrors -m64"
|
|
mksyscall="go run mksyscall.go -openbsd"
|
|
mksysctl="go run mksysctl_openbsd.go"
|
|
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
|
# Let the type of C char be signed for making the bare syscall
|
|
# API consistent across platforms.
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
|
;;
|
|
solaris_amd64)
|
|
mksyscall="go run mksyscall_solaris.go"
|
|
mkerrors="$mkerrors -m64"
|
|
mksysnum=
|
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
;;
|
|
*)
|
|
echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
(
|
|
if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
|
|
case "$GOOS" in
|
|
*)
|
|
syscall_goos="syscall_$GOOS.go"
|
|
case "$GOOS" in
|
|
darwin | dragonfly | freebsd | netbsd | openbsd)
|
|
syscall_goos="syscall_bsd.go $syscall_goos"
|
|
;;
|
|
esac
|
|
if [ -n "$mksyscall" ]; then
|
|
if [ "$GOOSARCH" == "aix_ppc64" ]; then
|
|
# aix/ppc64 script generates files instead of writing to stdin.
|
|
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
|
|
elif [ "$GOOS" == "darwin" ]; then
|
|
# pre-1.12, direct syscalls
|
|
echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos syscall_darwin_${GOARCH}.1_11.go $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
|
|
# 1.12 and later, syscalls via libSystem
|
|
echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
|
# 1.13 and later, syscalls via libSystem (including syscallPtr)
|
|
echo "$mksyscall -tags $GOOS,$GOARCH,go1.13 syscall_darwin.1_13.go |gofmt >zsyscall_$GOOSARCH.1_13.go";
|
|
else
|
|
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
|
fi
|
|
fi
|
|
esac
|
|
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
|
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
|
if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi
|
|
if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
|
|
) | $run
|