* SOFTWARE.
*/
+
+#include <afsconfig.h>
+#include <afs/param.h>
+#include <roken.h>
+
#include<windows.h>
#include <wchar.h>
#define _CRT_RAND_S
case 2:
if (space_limited)
space_available -= sizeof(InfoStruct->ShareInfo.Level2);
- InfoStruct->ShareInfo.Level2->Buffer = calloc((enump->count - enump->next), sizeof(SHARE_INFO_2));
+ InfoStruct->ShareInfo.Level2->Buffer = MIDL_user_allocate((enump->count - enump->next) * sizeof(SHARE_INFO_2));
break;
case 1:
if (space_limited)
space_available -= sizeof(InfoStruct->ShareInfo.Level1);
- InfoStruct->ShareInfo.Level1->Buffer = calloc((enump->count - enump->next), sizeof(SHARE_INFO_1));
+ InfoStruct->ShareInfo.Level1->Buffer = MIDL_user_allocate((enump->count - enump->next) * sizeof(SHARE_INFO_1));
break;
case 0:
if (space_limited)
space_available -= sizeof(InfoStruct->ShareInfo.Level0);
- InfoStruct->ShareInfo.Level0->Buffer = calloc((enump->count - enump->next), sizeof(SHARE_INFO_0));
+ InfoStruct->ShareInfo.Level0->Buffer = MIDL_user_allocate((enump->count - enump->next) * sizeof(SHARE_INFO_0));
break;
}
continue;
}
- cm_GetSCache(&entryp->fid, &scp, userp, &req);
+ cm_GetSCache(&entryp->fid, NULL, &scp, userp, &req);
switch (InfoStruct->Level) {
case 2:
dscp = cm_RootSCachep(userp, &req);
- /* Allocate the memory for the response */
- switch (Level) {
- case 2:
- InfoStruct->ShareInfo2 = calloc(1, sizeof(SHARE_INFO_2));
- break;
- case 1:
- InfoStruct->ShareInfo1 = calloc(1, sizeof(SHARE_INFO_1));
- break;
- case 0:
- InfoStruct->ShareInfo0 = calloc(1, sizeof(SHARE_INFO_0));
- break;
- }
-
- if (InfoStruct->ShareInfo0 == NULL) {
- return ERROR_NOT_ENOUGH_MEMORY;
- }
+ InfoStruct->ShareInfo0 = NULL;
/*
* NetName will be:
if (allSubmount) {
scp = dscp;
cm_HoldSCache(scp);
- }
+ code = 0;
+ } else {
+ code = CM_ERROR_NOSUCHPATH;
+ }
} else {
/*
* Could be a Submount, a directory entry, or a cell name we
if (cblen) {
code = cm_NameI(dscp, pathstr, CM_FLAG_FOLLOW, userp, NULL, &req, &scp);
- if (code && code != CM_ERROR_NOACCESS)
+ if (code == CM_ERROR_NOSUCHFILE ||
+ code == CM_ERROR_NOSUCHPATH ||
+ code == CM_ERROR_BPLUS_NOMATCH)
code = cm_NameI(dscp, pathstr, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
- userp, NULL, &req, &scp);
- }
+ userp, NULL, &req, &scp);
+ } else {
+ code = CM_ERROR_NOSUCHPATH;
+ }
}
}
if (scp) {
+ /* Allocate the memory for the response */
+ switch (Level) {
+ case 2:
+ InfoStruct->ShareInfo2 = MIDL_user_allocate(sizeof(SHARE_INFO_2));
+ break;
+ case 1:
+ InfoStruct->ShareInfo1 = MIDL_user_allocate(sizeof(SHARE_INFO_1));
+ break;
+ case 0:
+ InfoStruct->ShareInfo0 = MIDL_user_allocate(sizeof(SHARE_INFO_0));
+ break;
+ case 501:
+ case 502:
+ case 503:
+ case 1004:
+ case 1005:
+ case 1006:
+ default:
+ cm_ReleaseSCache(scp);
+ return HRESULT_FROM_WIN32(ERROR_INVALID_LEVEL);
+ }
+
+ if (InfoStruct->ShareInfo0 == NULL) {
+ cm_ReleaseSCache(scp);
+ return HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
+ }
+
switch (Level) {
case 2:
/* for share level security */
NetrIntGenerateSharePath(ServerName, &scp->fid);
/* must be the empty string */
InfoStruct->ShareInfo2->shi2_passwd = wcsdup(L"");
- /* fall-through */
+ AFS_FALLTHROUGH;
case 1:
InfoStruct->ShareInfo1->shi1_type = STYPE_DISKTREE;
InfoStruct->ShareInfo1->shi1_remark =
NetrIntGenerateShareRemark(scp, &scp->fid);
- /* fall-through */
+ AFS_FALLTHROUGH;
case 0:
/* Canonicalized version of NetName parameter */
InfoStruct->ShareInfo0->shi0_netname = wcsdup(NetName);
*/
switch (Level) {
case 103:
- InfoStruct->ServerInfo103 = calloc(1, sizeof(SERVER_INFO_103));
+ InfoStruct->ServerInfo103 = MIDL_user_allocate(sizeof(SERVER_INFO_103));
break;
case 102:
- InfoStruct->ServerInfo102 = calloc(1, sizeof(SERVER_INFO_102));
+ InfoStruct->ServerInfo102 = MIDL_user_allocate(sizeof(SERVER_INFO_102));
break;
case 101:
- InfoStruct->ServerInfo101 = calloc(1, sizeof(SERVER_INFO_101));
+ InfoStruct->ServerInfo101 = MIDL_user_allocate(sizeof(SERVER_INFO_101));
break;
case 100:
- InfoStruct->ServerInfo100 = calloc(1, sizeof(SERVER_INFO_100));
+ InfoStruct->ServerInfo100 = MIDL_user_allocate(sizeof(SERVER_INFO_100));
break;
}
switch (Level) {
case 103:
InfoStruct->ServerInfo103->sv103_capabilities = 0;
- /* fall-through */
+ AFS_FALLTHROUGH;
case 102:
InfoStruct->ServerInfo102->sv102_users = 0xFFFFFFFF;
InfoStruct->ServerInfo102->sv102_disc = SV_NODISC;
InfoStruct->ServerInfo102->sv102_anndelta = 0;
InfoStruct->ServerInfo102->sv102_licenses = 0;
InfoStruct->ServerInfo102->sv102_userpath = wcsdup(L"C:\\");
- /* fall-through */
+ AFS_FALLTHROUGH;
case 101:
InfoStruct->ServerInfo101->sv101_version_major = AFSPRODUCT_VERSION_MAJOR;
InfoStruct->ServerInfo101->sv101_version_minor = AFSPRODUCT_VERSION_MINOR;
InfoStruct->ServerInfo101->sv101_type = SV_TYPE_WORKSTATION | SV_TYPE_SERVER | SV_TYPE_SERVER_UNIX;
InfoStruct->ServerInfo101->sv101_comment = wcsdup(wAFSVersion);
- /* fall-through */
+ AFS_FALLTHROUGH;
case 100:
InfoStruct->ServerInfo100->sv100_platform_id = SV_PLATFORM_ID_AFS;
/* The Netbios Name */
{
}
-#if 0
-/* [nocode] */ void Opnum3NotUsedOnWire(
- /* [in] */ handle_t IDL_handle)
-{
-}
-
-/* [nocode] */ void Opnum4NotUsedOnWire(
- /* [in] */ handle_t IDL_handle)
-{
-}
-#endif
-
/* [nocode] */ void Opnum5NotUsedOnWire(
/* [in] */ handle_t IDL_handle)
{