/*
Winbind client API
Copyright (C) Gerald (Jerry) Carter 2007
Copyright (C) Volker Lendecke 2010
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Required Headers */
#include <stdio.h>
#include "libwbclient.h"
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
/* Convert a sid to a string into a buffer. Return the string
* length. If buflen is too small, return the string length that would
* result if it was long enough. */
{
int i, ofs;
if (!sid) {
return 10; /* strlen("(NULL SID)") */
}
if (id_auth >= UINT32_MAX) {
(unsigned long long)id_auth);
} else {
(unsigned long long)id_auth);
}
}
return ofs;
}
/* Convert a binary SID to a character string */
char **sid_string)
{
char *result;
int len;
if (!sid) {
return WBC_ERR_INVALID_SID;
}
return WBC_ERR_INVALID_SID;
}
return WBC_ERR_NO_MEMORY;
}
*sid_string = result;
return WBC_ERR_SUCCESS;
}
/* Convert a character string to a binary SID */
struct wbcDomainSid *sid)
{
const char *p;
char *q;
uint64_t x;
if (!sid) {
}
/* Sanity check for either "S-" or "s-" */
if (!str
{
}
/* Get the SID revision number */
p = str+2;
if (x==0 || x > UINT8_MAX || !q || *q!='-') {
}
/*
* Next the Identifier Authority. This is stored big-endian in a
* 6 byte array. If the authority value is >= UINT_MAX, then it should
* be expressed as a hex value, according to MS-DTYP.
*/
p = q+1;
x = strtoull(p, &q, 0);
if (!q || *q!='-' || (x & AUTHORITY_MASK)) {
}
/* now read the subauthorities */
p = q +1;
x = strtoull(p, &q, 10);
if (p == q)
break;
if (x > UINT32_MAX) {
}
if (*q != '-') {
break;
}
p = q + 1;
}
/* IF we ended early, then the SID could not be converted */
if (q && *q!='\0') {
}
done:
return wbc_status;
}
{
switch (type) {
case WBC_SID_NAME_USE_NONE: return "SID_NONE";
case WBC_SID_NAME_USER: return "SID_USER";
case WBC_SID_NAME_DOM_GRP: return "SID_DOM_GROUP";
case WBC_SID_NAME_DOMAIN: return "SID_DOMAIN";
case WBC_SID_NAME_ALIAS: return "SID_ALIAS";
case WBC_SID_NAME_WKN_GRP: return "SID_WKN_GROUP";
case WBC_SID_NAME_DELETED: return "SID_DELETED";
case WBC_SID_NAME_INVALID: return "SID_INVALID";
case WBC_SID_NAME_UNKNOWN: return "SID_UNKNOWN";
case WBC_SID_NAME_COMPUTER: return "SID_COMPUTER";
default: return "Unknown type";
}
}