![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
-##### Current tip version: 0.9.69 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
+##### Current tip version: 0.9.70 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
| Web | UI | Preview |
|:-------------:|:-------:|:-------:|
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.9.69.0808"
+const APP_VER = "0.9.70.0808"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
}
}
+// IsRunUserMatchCurrentUser returns false if configured run user does not match
+// actual user that runs the app. The first return value is the actual user name.
+// This check is ignored under Windows since SSH remote login is not the main
+// method to login on Windows.
+func IsRunUserMatchCurrentUser(runUser string) (string, bool) {
+ if IsWindows {
+ return "", true
+ }
+
+ currentUser := user.CurrentUsername()
+ return currentUser, runUser == currentUser
+}
+
// NewContext initializes configuration context.
// NOTE: do not print any log except error.
func NewContext() {
}[Cfg.Section("time").Key("FORMAT").MustString("RFC1123")]
RunUser = Cfg.Section("").Key("RUN_USER").String()
- curUser := user.CurrentUsername()
// Does not check run user when the install lock is off.
- if InstallLock && RunUser != curUser {
- log.Fatal(4, "Expect user(%s) but current user is: %s", RunUser, curUser)
+ if InstallLock {
+ currentUser, match := IsRunUserMatchCurrentUser(RunUser)
+ if !match {
+ log.Fatal(4, "Expect user '%s' but current user is: %s", RunUser, currentUser)
+ }
}
// Determine and create root git repository path.
return
}
- // Check run user.
- curUser := user.CurrentUsername()
- if form.RunUser != curUser {
+ currentUser, match := setting.IsRunUserMatchCurrentUser(form.RunUser)
+ if !match {
ctx.Data["Err_RunUser"] = true
- ctx.RenderWithErr(ctx.Tr("install.run_user_not_match", form.RunUser, curUser), INSTALL, &form)
+ ctx.RenderWithErr(ctx.Tr("install.run_user_not_match", form.RunUser, currentUser), INSTALL, &form)
return
}