Import Anubis v1.28.2
Replace the tree with upstream TecharoHQ/anubis v1.28.2 (a1384fbf42e3). Masyunis customizations are re-applied in the following commits.
This commit is contained in:
1 parent
eb3e46d8d0
commit
e07de898cd
573 files changed
+35846
-6807
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package servicesid
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestServiceSID(t *testing.T) {
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
service string
|
||||
want string
|
||||
}{
|
||||
{
|
||||
// TrustedInstaller ships with Windows and its SID is published in
|
||||
// enough places to serve as a known-answer test for the whole
|
||||
// derivation. If this case fails, the arithmetic is wrong.
|
||||
name: "TrustedInstaller matches the published SID",
|
||||
service: "TrustedInstaller",
|
||||
want: "S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464",
|
||||
},
|
||||
{
|
||||
// Pins the hardcoded constant to the derivation. Renaming the
|
||||
// service without recomputing the SID fails here rather than on a
|
||||
// Windows box, where it would surface as the service being unable
|
||||
// to read its own configuration.
|
||||
name: "the pinned Anubis SID is the derived one",
|
||||
service: AnubisServiceName,
|
||||
want: AnubisServiceSID,
|
||||
},
|
||||
{
|
||||
// The name is uppercased before hashing, so case in the service
|
||||
// name must not reach the digest.
|
||||
name: "case in the service name does not matter",
|
||||
service: "aNuBiS",
|
||||
want: AnubisServiceSID,
|
||||
},
|
||||
} {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if got := Encode(tt.service); got != tt.want {
|
||||
t.Errorf("Encode(%q) = %q, want %q", tt.service, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user