4 * Copyright (C) 1998 Alexandre Julliard
5 * Copyright (C) 2003 Mike McCormack
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37 struct object obj
; /* object header */
40 static void token_dump( struct object
*obj
, int verbose
);
42 static const struct object_ops token_ops
=
44 sizeof(struct token
), /* size */
45 token_dump
, /* dump */
46 no_add_queue
, /* add_queue */
47 NULL
, /* remove_queue */
50 no_get_fd
, /* get_fd */
51 no_destroy
/* destroy */
55 static void token_dump( struct object
*obj
, int verbose
)
57 fprintf( stderr
, "Security token\n" );
60 struct token
*create_token( void )
62 struct token
*token
= alloc_object( &token_ops
);
66 /* open a security token */
67 DECL_HANDLER(open_token
)
69 if( req
->flags
& OPEN_TOKEN_THREAD
)
71 struct thread
*thread
= get_thread_from_handle( req
->handle
, 0 );
75 reply
->token
= alloc_handle( current
->process
, thread
->token
, TOKEN_ALL_ACCESS
, 0);
76 release_object( thread
);
81 struct process
*process
= get_process_from_handle( req
->handle
, 0 );
85 reply
->token
= alloc_handle( current
->process
, process
->token
, TOKEN_ALL_ACCESS
, 0);
86 release_object( process
);