(file) Return to credcache.h CVS log (file) (dir) Up to [OMI] / omi / base

 1 mike  1.1 /*
 2           **==============================================================================
 3           **
 4           ** Open Management Infrastructure (OMI)
 5           **
 6           ** Copyright (c) Microsoft Corporation
 7           ** 
 8           ** Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 9           ** use this file except in compliance with the License. You may obtain a copy 
10           ** of the License at 
11           **
12           **     http://www.apache.org/licenses/LICENSE-2.0 
13           **
14           ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15           ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
16           ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
17           ** MERCHANTABLITY OR NON-INFRINGEMENT. 
18           **
19           ** See the Apache 2 License for the specific language governing permissions 
20           ** and limitations under the License.
21           **
22 mike  1.1 **==============================================================================
23           */
24           
25           #ifndef _omi_credcache_h
26           #define _omi_credcache_h
27           
28           #include <common.h>
29 krisbash 1.3 #include <pal/strings.h>
30              
31 mike     1.1 #if defined(CONFIG_POSIX)
32              
33              BEGIN_EXTERNC
34              
35              /* 
36                  Adds user name and password into cache
37              */
38              void CredCache_PutUser(const char* user, const char* password);
39              
40              /* 
41                  Checks if user credentials matches the one in cache
42                  Returns:
43                  '0' if user account matches entry in cache
44                  '-1' if user is not in cache, if password does not match or
45                      record expired
46              */
47              int CredCache_CheckUser(const char* user, const char* password);
48              
49              /* Unit-test support - updating expiration timeout */
50              void CredCache_SetExpirationTimeout(MI_Uint64 expirationTimeUS);
51              /* Unit-test support mostly - clear all cached items */
52 mike     1.1 void CredCache_Clean();
53              
54              /* security-related utility */
55              /*
56                  Generates crypto-suitable random data
57                  Parameters:
58                  buf - bufer for random data
59                  size - number of bytes to generate
60              
61                  Returns:
62                  0 - success
63                  -1 - failed
64              */
65              int CredCache_GenerateRandom(
66                  char* buf,
67                  size_t  size);
68              
69              END_EXTERNC
70              
71 krisbash 1.3 #else
72              #endif
73              
74 mike     1.1 #endif /* _omi_credcache_h */

ViewCVS 0.9.2