Check-in [0874801b3e]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ensure User ID is sane before calling fossil
Timelines: family | ancestors | descendants | both | setuid-fossil
Files: files | file ages | folders
SHA1:0874801b3e3864b65f099bd07f8b606ca9a46a4a
User & Date: rkeene 2019-01-07 23:07:19
Context
2019-01-07
23:29
Finished comment Leaf check-in: afc1e902de user: rkeene tags: setuid-fossil
23:07
Ensure User ID is sane before calling fossil check-in: 0874801b3e user: rkeene tags: setuid-fossil
22:40
Started work on running Fossil as different OS user per Flint user check-in: 91893d0dc3 user: rkeene tags: setuid-fossil
Changes

Changes to scripts/fossil-as-user/suid-fossil.cr.

69
70
71
72
73
74
75









76
77
78
79
80
81
82
	info = File.info(file)

	Int32.new(info.owner - UID_OFFSET)
end

# Run Fossil, wrapped as a Flint UserName/UserID
def suid_fossil(username : String, userid : Int32, fossil_args : Array, fossil_command = "fossil")









	# Compute OS UID from Flint User ID
	uid = userid + UID_OFFSET

	# Create Fossil home directory
	home = "/tmp/suid-fossil/#{userid}"

	if !Dir.exists?(home)







>
>
>
>
>
>
>
>
>







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
	info = File.info(file)

	Int32.new(info.owner - UID_OFFSET)
end

# Run Fossil, wrapped as a Flint UserName/UserID
def suid_fossil(username : String, userid : Int32, fossil_args : Array, fossil_command = "fossil")
	# Ensure that the user ID is sane
	if userid < 0
		raise "User ID out of bounds (too low)"
	end

	if userid > (UInt32.new(Int32::MAX) - UID_OFFSET - 1)
		raise "User ID out of bounds (too high)"
	end

	# Compute OS UID from Flint User ID
	uid = userid + UID_OFFSET

	# Create Fossil home directory
	home = "/tmp/suid-fossil/#{userid}"

	if !Dir.exists?(home)