@@ -249,46 +249,53 @@ impl SocketCred {
249
249
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
250
250
#[ must_use]
251
251
pub fn new ( ) -> SocketCred {
252
- SocketCred ( libc:: cmsgcred { cmsgcred_pid : 0 , cmsgcred_uid : 0 , cmsgcred_gid : 0 } )
252
+ SocketCred ( libc:: cmsgcred {
253
+ cmcred_pid : 0 ,
254
+ cmcred_uid : 0 ,
255
+ cmcred_euid : 0 ,
256
+ cmcred_gid : 0 ,
257
+ cmcred_ngroups : 0 ,
258
+ cmcred_groups : [ 0 ; libc:: CMGROUP_MAX ] ,
259
+ } )
253
260
}
254
261
255
262
/// Set the PID.
256
263
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
257
264
pub fn set_pid ( & mut self , pid : libc:: pid_t ) {
258
- self . 0 . cmsgcred_pid = pid;
265
+ self . 0 . cmcred_pid = pid;
259
266
}
260
267
261
268
/// Get the current PID.
262
269
#[ must_use]
263
270
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
264
271
pub fn get_pid ( & self ) -> libc:: pid_t {
265
- self . 0 . cmsgcred_pid
272
+ self . 0 . cmcred_pid
266
273
}
267
274
268
275
/// Set the UID.
269
276
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
270
277
pub fn set_uid ( & mut self , uid : libc:: uid_t ) {
271
- self . 0 . cmsgcred_uid = uid;
278
+ self . 0 . cmcred_uid = uid;
272
279
}
273
280
274
281
/// Get the current UID.
275
282
#[ must_use]
276
283
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
277
284
pub fn get_uid ( & self ) -> libc:: uid_t {
278
- self . 0 . cmsgcred_uid
285
+ self . 0 . cmcred_uid
279
286
}
280
287
281
288
/// Set the GID.
282
289
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
283
290
pub fn set_gid ( & mut self , gid : libc:: gid_t ) {
284
- self . 0 . cmsgcred_gid = gid;
291
+ self . 0 . cmcred_gid = gid;
285
292
}
286
293
287
294
/// Get the current GID.
288
295
#[ must_use]
289
296
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
290
297
pub fn get_gid ( & self ) -> libc:: gid_t {
291
- self . 0 . cmsgcred_gid
298
+ self . 0 . cmcred_gid
292
299
}
293
300
}
294
301
@@ -340,7 +347,7 @@ pub enum AncillaryError {
340
347
#[ unstable( feature = "unix_socket_ancillary_data" , issue = "76915" ) ]
341
348
pub enum AncillaryData < ' a > {
342
349
ScmRights ( ScmRights < ' a > ) ,
343
- #[ cfg( any( doc, target_os = "android" , target_os = "linux" , ) ) ]
350
+ #[ cfg( any( doc, target_os = "android" , target_os = "linux" , target_os = "dragonfly" ) ) ]
344
351
ScmCredentials ( ScmCredentials < ' a > ) ,
345
352
}
346
353
@@ -363,7 +370,7 @@ impl<'a> AncillaryData<'a> {
363
370
///
364
371
/// `data` must contain a valid control message and the control message must be type of
365
372
/// `SOL_SOCKET` and level of `SCM_CREDENTIALS` or `SCM_CREDS`.
366
- #[ cfg( any( doc, target_os = "android" , target_os = "linux" , ) ) ]
373
+ #[ cfg( any( doc, target_os = "android" , target_os = "linux" , target_os = "dragonfly" ) ) ]
367
374
unsafe fn as_credentials ( data : & ' a [ u8 ] ) -> Self {
368
375
let ancillary_data_iter = AncillaryDataIter :: new ( data) ;
369
376
let scm_credentials = ScmCredentials ( ancillary_data_iter) ;
0 commit comments