fix initgroups_dyn
This commit is contained in:
parent
f63c7f317c
commit
63a6756a6b
@ -11,6 +11,7 @@ const Allocator = mem.Allocator;
|
|||||||
const DB = @import("DB.zig");
|
const DB = @import("DB.zig");
|
||||||
const File = @import("File.zig");
|
const File = @import("File.zig");
|
||||||
const ErrCtx = @import("ErrCtx.zig");
|
const ErrCtx = @import("ErrCtx.zig");
|
||||||
|
const compress = @import("compress.zig");
|
||||||
const CGroup = @import("Group.zig").CGroup;
|
const CGroup = @import("Group.zig").CGroup;
|
||||||
const PackedGroup = @import("PackedGroup.zig");
|
const PackedGroup = @import("PackedGroup.zig");
|
||||||
const CUser = @import("User.zig").CUser;
|
const CUser = @import("User.zig").CUser;
|
||||||
@ -476,8 +477,13 @@ fn initgroups_dyn(
|
|||||||
return c.NSS_STATUS_NOTFOUND;
|
return c.NSS_STATUS_NOTFOUND;
|
||||||
};
|
};
|
||||||
|
|
||||||
var gids = db.userGids(user.additional_gids_offset);
|
// TODO: use db.userGids()
|
||||||
if (size.* < gids.remaining()) {
|
const offset = user.additional_gids_offset;
|
||||||
|
var vit = compress.varintSliceIteratorMust(db.additional_gids[offset..]);
|
||||||
|
const remaining = vit.remaining;
|
||||||
|
|
||||||
|
var gids = compress.deltaDecompressionIterator(&vit);
|
||||||
|
if (size.* < remaining) {
|
||||||
const oldsize = @intCast(usize, size.*);
|
const oldsize = @intCast(usize, size.*);
|
||||||
const newsize = if (limit <= 0)
|
const newsize = if (limit <= 0)
|
||||||
oldsize + gids.remaining()
|
oldsize + gids.remaining()
|
||||||
|
Loading…
Reference in New Issue
Block a user