Blame winpr/libwinpr/dsparse/dsparse.c

Packit 1fb8d4
/**
Packit 1fb8d4
 * WinPR: Windows Portable Runtime
Packit 1fb8d4
 * Active Directory Domain Services Parsing Functions
Packit 1fb8d4
 *
Packit 1fb8d4
 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Packit 1fb8d4
 *
Packit 1fb8d4
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit 1fb8d4
 * you may not use this file except in compliance with the License.
Packit 1fb8d4
 * You may obtain a copy of the License at
Packit 1fb8d4
 *
Packit 1fb8d4
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 1fb8d4
 *
Packit 1fb8d4
 * Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1fb8d4
 * See the License for the specific language governing permissions and
Packit 1fb8d4
 * limitations under the License.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifdef HAVE_CONFIG_H
Packit 1fb8d4
#include "config.h"
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#include <winpr/dsparse.h>
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * dsparse.dll:
Packit 1fb8d4
 *
Packit 1fb8d4
 * DsCrackSpnA
Packit 1fb8d4
 * DsCrackSpnW
Packit 1fb8d4
 * DsCrackUnquotedMangledRdnA
Packit 1fb8d4
 * DsCrackUnquotedMangledRdnW
Packit 1fb8d4
 * DsGetRdnW
Packit 1fb8d4
 * DsIsMangledDnA
Packit 1fb8d4
 * DsIsMangledDnW
Packit 1fb8d4
 * DsIsMangledRdnValueA
Packit 1fb8d4
 * DsIsMangledRdnValueW
Packit 1fb8d4
 * DsMakeSpnA
Packit 1fb8d4
 * DsMakeSpnW
Packit 1fb8d4
 * DsQuoteRdnValueA
Packit 1fb8d4
 * DsQuoteRdnValueW
Packit 1fb8d4
 * DsUnquoteRdnValueA
Packit 1fb8d4
 * DsUnquoteRdnValueW
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#if !defined(_WIN32) || defined(_UWP)
Packit 1fb8d4
Packit 1fb8d4
DWORD DsCrackSpnW(LPCWSTR pszSpn, DWORD* pcServiceClass, LPWSTR ServiceClass, DWORD* pcServiceName,
Packit Service 5a9772
                  LPWSTR ServiceName, DWORD* pcInstanceName, LPWSTR InstanceName,
Packit Service 5a9772
                  USHORT* pInstancePort)
Packit 1fb8d4
{
Packit 1fb8d4
	return 0;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
DWORD DsCrackSpnA(LPCSTR pszSpn, LPDWORD pcServiceClass, LPSTR ServiceClass, LPDWORD pcServiceName,
Packit Service 5a9772
                  LPSTR ServiceName, LPDWORD pcInstanceName, LPSTR InstanceName,
Packit Service 5a9772
                  USHORT* pInstancePort)
Packit 1fb8d4
{
Packit 1fb8d4
	return 0;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
DWORD DsMakeSpnW(LPCWSTR ServiceClass, LPCWSTR ServiceName, LPCWSTR InstanceName,
Packit Service 5a9772
                 USHORT InstancePort, LPCWSTR Referrer, DWORD* pcSpnLength, LPWSTR pszSpn)
Packit 1fb8d4
{
Packit 1fb8d4
	return 0;
Packit 1fb8d4
}
Packit 1fb8d4
Packit Service 5a9772
DWORD DsMakeSpnA(LPCSTR ServiceClass, LPCSTR ServiceName, LPCSTR InstanceName, USHORT InstancePort,
Packit Service 5a9772
                 LPCSTR Referrer, DWORD* pcSpnLength, LPSTR pszSpn)
Packit 1fb8d4
{
Packit 1fb8d4
	DWORD SpnLength;
Packit 1fb8d4
	DWORD ServiceClassLength;
Packit 1fb8d4
	DWORD ServiceNameLength;
Packit 1fb8d4
Packit 1fb8d4
	if ((*pcSpnLength != 0) && (pszSpn == NULL))
Packit 1fb8d4
		return ERROR_INVALID_PARAMETER;
Packit 1fb8d4
Packit Service 5a9772
	ServiceClassLength = (DWORD)strlen(ServiceClass);
Packit Service 5a9772
	ServiceNameLength = (DWORD)strlen(ServiceName);
Packit 1fb8d4
Packit 1fb8d4
	SpnLength = ServiceClassLength + 1 + ServiceNameLength + 1;
Packit 1fb8d4
Packit 1fb8d4
	if ((*pcSpnLength == 0) || (*pcSpnLength < SpnLength))
Packit 1fb8d4
	{
Packit 1fb8d4
		*pcSpnLength = SpnLength;
Packit 1fb8d4
		return ERROR_BUFFER_OVERFLOW;
Packit 1fb8d4
	}
Packit 1fb8d4
Packit 1fb8d4
	sprintf_s(pszSpn, *pcSpnLength, "%s/%s", ServiceClass, ServiceName);
Packit 1fb8d4
Packit 1fb8d4
	return ERROR_SUCCESS;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
#endif