1 /**
2  * WinPR: Windows Portable Runtime
3  * Credentials Management
4  *
5  * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 #include <winpr/crt.h>
25 
26 #include <winpr/credentials.h>
27 
28 /*
29  * Low-Level Credentials Management Functions:
30  * http://msdn.microsoft.com/en-us/library/windows/desktop/aa374731(v=vs.85).aspx#low_level_credentials_management_functions
31  */
32 
33 #ifndef _WIN32
34 
CredWriteW(PCREDENTIALW Credential,DWORD Flags)35 BOOL CredWriteW(PCREDENTIALW Credential, DWORD Flags)
36 {
37 	return TRUE;
38 }
39 
CredWriteA(PCREDENTIALA Credential,DWORD Flags)40 BOOL CredWriteA(PCREDENTIALA Credential, DWORD Flags)
41 {
42 	return TRUE;
43 }
44 
CredReadW(LPCWSTR TargetName,DWORD Type,DWORD Flags,PCREDENTIALW * Credential)45 BOOL CredReadW(LPCWSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALW* Credential)
46 {
47 	return TRUE;
48 }
49 
CredReadA(LPCSTR TargetName,DWORD Type,DWORD Flags,PCREDENTIALA * Credential)50 BOOL CredReadA(LPCSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALA* Credential)
51 {
52 	return TRUE;
53 }
54 
CredEnumerateW(LPCWSTR Filter,DWORD Flags,DWORD * Count,PCREDENTIALW ** Credential)55 BOOL CredEnumerateW(LPCWSTR Filter, DWORD Flags, DWORD* Count, PCREDENTIALW** Credential)
56 {
57 	return TRUE;
58 }
59 
CredEnumerateA(LPCSTR Filter,DWORD Flags,DWORD * Count,PCREDENTIALA ** Credential)60 BOOL CredEnumerateA(LPCSTR Filter, DWORD Flags, DWORD* Count, PCREDENTIALA** Credential)
61 {
62 	return TRUE;
63 }
64 
CredWriteDomainCredentialsW(PCREDENTIAL_TARGET_INFORMATIONW TargetInfo,PCREDENTIALW Credential,DWORD Flags)65 BOOL CredWriteDomainCredentialsW(PCREDENTIAL_TARGET_INFORMATIONW TargetInfo,
66                                  PCREDENTIALW Credential, DWORD Flags)
67 {
68 	return TRUE;
69 }
70 
CredWriteDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInfo,PCREDENTIALA Credential,DWORD Flags)71 BOOL CredWriteDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInfo,
72                                  PCREDENTIALA Credential, DWORD Flags)
73 {
74 	return TRUE;
75 }
76 
CredReadDomainCredentialsW(PCREDENTIAL_TARGET_INFORMATIONW TargetInfo,DWORD Flags,DWORD * Count,PCREDENTIALW ** Credential)77 BOOL CredReadDomainCredentialsW(PCREDENTIAL_TARGET_INFORMATIONW TargetInfo, DWORD Flags,
78                                 DWORD* Count, PCREDENTIALW** Credential)
79 {
80 	return TRUE;
81 }
82 
CredReadDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInfo,DWORD Flags,DWORD * Count,PCREDENTIALA ** Credential)83 BOOL CredReadDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInfo, DWORD Flags,
84                                 DWORD* Count, PCREDENTIALA** Credential)
85 {
86 	return TRUE;
87 }
88 
CredDeleteW(LPCWSTR TargetName,DWORD Type,DWORD Flags)89 BOOL CredDeleteW(LPCWSTR TargetName, DWORD Type, DWORD Flags)
90 {
91 	return TRUE;
92 }
93 
CredDeleteA(LPCSTR TargetName,DWORD Type,DWORD Flags)94 BOOL CredDeleteA(LPCSTR TargetName, DWORD Type, DWORD Flags)
95 {
96 	return TRUE;
97 }
98 
CredRenameW(LPCWSTR OldTargetName,LPCWSTR NewTargetName,DWORD Type,DWORD Flags)99 BOOL CredRenameW(LPCWSTR OldTargetName, LPCWSTR NewTargetName, DWORD Type, DWORD Flags)
100 {
101 	return TRUE;
102 }
103 
CredRenameA(LPCSTR OldTargetName,LPCSTR NewTargetName,DWORD Type,DWORD Flags)104 BOOL CredRenameA(LPCSTR OldTargetName, LPCSTR NewTargetName, DWORD Type, DWORD Flags)
105 {
106 	return TRUE;
107 }
108 
CredGetTargetInfoW(LPCWSTR TargetName,DWORD Flags,PCREDENTIAL_TARGET_INFORMATIONW * TargetInfo)109 BOOL CredGetTargetInfoW(LPCWSTR TargetName, DWORD Flags,
110                         PCREDENTIAL_TARGET_INFORMATIONW* TargetInfo)
111 {
112 	return TRUE;
113 }
114 
CredGetTargetInfoA(LPCSTR TargetName,DWORD Flags,PCREDENTIAL_TARGET_INFORMATIONA * TargetInfo)115 BOOL CredGetTargetInfoA(LPCSTR TargetName, DWORD Flags, PCREDENTIAL_TARGET_INFORMATIONA* TargetInfo)
116 {
117 	return TRUE;
118 }
119 
CredMarshalCredentialW(CRED_MARSHAL_TYPE CredType,PVOID Credential,LPWSTR * MarshaledCredential)120 BOOL CredMarshalCredentialW(CRED_MARSHAL_TYPE CredType, PVOID Credential,
121                             LPWSTR* MarshaledCredential)
122 {
123 	return TRUE;
124 }
125 
CredMarshalCredentialA(CRED_MARSHAL_TYPE CredType,PVOID Credential,LPSTR * MarshaledCredential)126 BOOL CredMarshalCredentialA(CRED_MARSHAL_TYPE CredType, PVOID Credential,
127                             LPSTR* MarshaledCredential)
128 {
129 	return TRUE;
130 }
131 
CredUnmarshalCredentialW(LPCWSTR MarshaledCredential,PCRED_MARSHAL_TYPE CredType,PVOID * Credential)132 BOOL CredUnmarshalCredentialW(LPCWSTR MarshaledCredential, PCRED_MARSHAL_TYPE CredType,
133                               PVOID* Credential)
134 {
135 	return TRUE;
136 }
137 
CredUnmarshalCredentialA(LPCSTR MarshaledCredential,PCRED_MARSHAL_TYPE CredType,PVOID * Credential)138 BOOL CredUnmarshalCredentialA(LPCSTR MarshaledCredential, PCRED_MARSHAL_TYPE CredType,
139                               PVOID* Credential)
140 {
141 	return TRUE;
142 }
143 
CredIsMarshaledCredentialW(LPCWSTR MarshaledCredential)144 BOOL CredIsMarshaledCredentialW(LPCWSTR MarshaledCredential)
145 {
146 	return TRUE;
147 }
148 
CredIsMarshaledCredentialA(LPCSTR MarshaledCredential)149 BOOL CredIsMarshaledCredentialA(LPCSTR MarshaledCredential)
150 {
151 	return TRUE;
152 }
153 
CredProtectW(BOOL fAsSelf,LPWSTR pszCredentials,DWORD cchCredentials,LPWSTR pszProtectedCredentials,DWORD * pcchMaxChars,CRED_PROTECTION_TYPE * ProtectionType)154 BOOL CredProtectW(BOOL fAsSelf, LPWSTR pszCredentials, DWORD cchCredentials,
155                   LPWSTR pszProtectedCredentials, DWORD* pcchMaxChars,
156                   CRED_PROTECTION_TYPE* ProtectionType)
157 {
158 	return TRUE;
159 }
160 
CredProtectA(BOOL fAsSelf,LPSTR pszCredentials,DWORD cchCredentials,LPSTR pszProtectedCredentials,DWORD * pcchMaxChars,CRED_PROTECTION_TYPE * ProtectionType)161 BOOL CredProtectA(BOOL fAsSelf, LPSTR pszCredentials, DWORD cchCredentials,
162                   LPSTR pszProtectedCredentials, DWORD* pcchMaxChars,
163                   CRED_PROTECTION_TYPE* ProtectionType)
164 {
165 	return TRUE;
166 }
167 
CredUnprotectW(BOOL fAsSelf,LPWSTR pszProtectedCredentials,DWORD cchCredentials,LPWSTR pszCredentials,DWORD * pcchMaxChars)168 BOOL CredUnprotectW(BOOL fAsSelf, LPWSTR pszProtectedCredentials, DWORD cchCredentials,
169                     LPWSTR pszCredentials, DWORD* pcchMaxChars)
170 {
171 	return TRUE;
172 }
173 
CredUnprotectA(BOOL fAsSelf,LPSTR pszProtectedCredentials,DWORD cchCredentials,LPSTR pszCredentials,DWORD * pcchMaxChars)174 BOOL CredUnprotectA(BOOL fAsSelf, LPSTR pszProtectedCredentials, DWORD cchCredentials,
175                     LPSTR pszCredentials, DWORD* pcchMaxChars)
176 {
177 	return TRUE;
178 }
179 
CredIsProtectedW(LPWSTR pszProtectedCredentials,CRED_PROTECTION_TYPE * pProtectionType)180 BOOL CredIsProtectedW(LPWSTR pszProtectedCredentials, CRED_PROTECTION_TYPE* pProtectionType)
181 {
182 	return TRUE;
183 }
184 
CredIsProtectedA(LPSTR pszProtectedCredentials,CRED_PROTECTION_TYPE * pProtectionType)185 BOOL CredIsProtectedA(LPSTR pszProtectedCredentials, CRED_PROTECTION_TYPE* pProtectionType)
186 {
187 	return TRUE;
188 }
189 
CredFindBestCredentialW(LPCWSTR TargetName,DWORD Type,DWORD Flags,PCREDENTIALW * Credential)190 BOOL CredFindBestCredentialW(LPCWSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALW* Credential)
191 {
192 	return TRUE;
193 }
194 
CredFindBestCredentialA(LPCSTR TargetName,DWORD Type,DWORD Flags,PCREDENTIALA * Credential)195 BOOL CredFindBestCredentialA(LPCSTR TargetName, DWORD Type, DWORD Flags, PCREDENTIALA* Credential)
196 {
197 	return TRUE;
198 }
199 
CredGetSessionTypes(DWORD MaximumPersistCount,LPDWORD MaximumPersist)200 BOOL CredGetSessionTypes(DWORD MaximumPersistCount, LPDWORD MaximumPersist)
201 {
202 	return TRUE;
203 }
204 
CredFree(PVOID Buffer)205 VOID CredFree(PVOID Buffer)
206 {
207 }
208 
209 #endif
210