{
time_t diff_t = unixTime - smb_localZero;
#if defined(DEBUG) && !defined(_USE_32BIT_TIME_T)
- osi_assert(diff_t < _UI32_MAX);
+ osi_assertx(diff_t < _UI32_MAX, "time_t > _UI32_MAX");
#endif
*dosUTimep = (afs_uint32)diff_t;
}
if (nts != STATUS_SUCCESS)
osi_Log4(smb_logp,"MsV1_0Lm20ChallengeRequest failure: nts 0x%x ntsEx 0x%x respSize is %u needs %u",
nts, ntsEx, sizeof(lsaReq), lsaRespSize);
- osi_assert(nts == STATUS_SUCCESS); /* this had better work! */
+ osi_assertx(nts == STATUS_SUCCESS, "LsaCallAuthenticationPackage failed"); /* this had better work! */
memcpy(vcp->encKey, lsaResp->ChallengeToClient, MSV1_0_CHALLENGE_LENGTH);
LsaFreeReturnBuffer(lsaResp);
userp = NULL;
lock_ObtainWrite(&smb_rctLock);
- osi_assert(tidp->refCount-- > 0);
+ osi_assertx(tidp->refCount-- > 0, "smb_tid_t refCount 0");
if (tidp->refCount == 0 && (tidp->delete)) {
ltpp = &tidp->vcp->tidsp;
for(tp = *ltpp; tp; ltpp = &tp->nextp, tp = *ltpp) {
if (tp == tidp)
break;
}
- osi_assert(tp != NULL);
+ osi_assertx(tp != NULL, "null smb_tid_t");
*ltpp = tp->nextp;
lock_FinalizeMutex(&tidp->mx);
userp = tidp->userp; /* remember to drop ref later */
time_t now = osi_Time();
lock_ObtainWrite(&smb_rctLock);
- osi_assert(unp->refCount-- > 0);
+ osi_assertx(unp->refCount-- > 0, "smb_username_t refCount 0");
if (unp->refCount == 0 && !(unp->flags & SMB_USERNAMEFLAG_AFSLOGON) &&
(unp->flags & SMB_USERNAMEFLAG_LOGOFF)) {
lupp = &usernamesp;
if (up == unp)
break;
}
- osi_assert(up != NULL);
+ osi_assertx(up != NULL, "null smb_username_t");
*lupp = up->nextp;
up->nextp = NULL; /* do not remove this */
lock_FinalizeMutex(&unp->mx);
smb_username_t *unp = NULL;
lock_ObtainWrite(&smb_rctLock);
- osi_assert(uidp->refCount-- > 0);
+ osi_assertx(uidp->refCount-- > 0, "smb_user_t refCount 0");
if (uidp->refCount == 0) {
lupp = &uidp->vcp->usersp;
for(up = *lupp; up; lupp = &up->nextp, up = *lupp) {
if (up == uidp)
break;
}
- osi_assert(up != NULL);
+ osi_assertx(up != NULL, "null smb_user_t");
*lupp = up->nextp;
lock_FinalizeMutex(&uidp->mx);
unp = uidp->unp;
lock_ObtainMutex(&fidp->mx);
lock_ObtainWrite(&smb_rctLock);
- osi_assert(fidp->refCount-- > 0);
+ osi_assertx(fidp->refCount-- > 0, "smb_fid_t refCount 0");
if (fidp->refCount == 0 && (fidp->delete)) {
vcp = fidp->vcp;
fidp->vcp = NULL;
cm_scache_t *scp = NULL;
lock_ObtainMutex(&dsp->mx);
- osi_assert(dsp->refCount-- > 0);
+ osi_assertx(dsp->refCount-- > 0, "cm_scache_t refCount 0");
if (dsp->refCount == 0 && (dsp->flags & SMB_DIRSEARCH_DELETE)) {
if (&dsp->q == (osi_queue_t *) smb_lastDirSearchp)
smb_lastDirSearchp = (smb_dirSearch_t *) osi_QPrev(&smb_lastDirSearchp->q);
tbp->dos_pkt_sel = tb_sel;
#endif /* DJGPP */
}
- osi_assert(tbp->magic == SMB_PACKETMAGIC);
+ osi_assertx(tbp->magic == SMB_PACKETMAGIC, "invalid smb_packet_t magic");
return tbp;
}
tbp->magic = SMB_NCBMAGIC;
}
- osi_assert(tbp->magic == SMB_NCBMAGIC);
+ osi_assertx(tbp->magic == SMB_NCBMAGIC, "invalid smb_packet_t magic");
memset(&tbp->ncb, 0, sizeof(NCB));
ncbp = &tbp->ncb;
void smb_FreePacket(smb_packet_t *tbp)
{
smb_vc_t * vcp = NULL;
- osi_assert(tbp->magic == SMB_PACKETMAGIC);
+ osi_assertx(tbp->magic == SMB_PACKETMAGIC, "invalid smb_packet_t magic");
lock_ObtainWrite(&smb_globalLock);
tbp->nextp = smb_packetFreeListp;
smb_ncb_t *tbp;
tbp = (smb_ncb_t *) bufferp;
- osi_assert(tbp->magic == SMB_NCBMAGIC);
+ osi_assertx(tbp->magic == SMB_NCBMAGIC, "invalid smb_packet_t magic");
lock_ObtainWrite(&smb_globalLock);
tbp->nextp = smb_ncbFreeListp;
if (wl->state == SMB_WAITINGLOCKSTATE_DONE)
continue;
- osi_assert(wl->state != SMB_WAITINGLOCKSTATE_ERROR);
+ osi_assertx(wl->state != SMB_WAITINGLOCKSTATE_ERROR, "!SMB_WAITINGLOCKSTATE_ERROR");
/* wl->state is either _DONE or _WAITING. _ERROR
would no longer be on the queue. */
/* pull pathname and stat block out of request */
tp = smb_GetSMBData(inp, NULL);
pathp = smb_ParseASCIIBlock(tp, (char **) &tp);
- osi_assert(pathp != NULL);
+ osi_assertx(pathp != NULL, "null path");
if (smb_StoreAnsiFilenames)
OemToChar(pathp,pathp);
statBlockp = smb_ParseVblBlock(tp, (char **) &tp, &statLen);
- osi_assert(statBlockp != NULL);
+ osi_assertx(statBlockp != NULL, "null statBlock");
if (statLen == 0) {
statBlockp = initStatBlock;
statBlockp[0] = 8;
* Deduct for them and fill in the length field.
*/
temp -= 3; /* deduct vbl block info */
- osi_assert(temp == (43 * returnedNames));
+ osi_assertx(temp == (43 * returnedNames), "unexpected data length");
origOp[1] = (char)(temp & 0xff);
origOp[2] = (char)((temp>>8) & 0xff);
if (returnedNames == 0)
}
fidp = smb_FindFID(vcp, 0, SMB_FLAG_CREATE);
- osi_assert(fidp);
+ osi_assertx(fidp, "null smb_fid_t");
/* save a pointer to the vnode */
fidp->scp = scp;
fidp->NTopen_pathp = NULL;
fidp->flags &= ~SMB_FID_NTOPEN;
} else {
- osi_assert(fidp->NTopen_dscp == NULL);
- osi_assert(fidp->NTopen_pathp == NULL);
+ osi_assertx(fidp->NTopen_dscp == NULL, "null NTopen_dsc");
+ osi_assertx(fidp->NTopen_pathp == NULL, "null NTopen_path");
}
if (fidp->NTopen_wholepathp) {
/* now all we have to do is open the file itself */
fidp = smb_FindFID(vcp, 0, SMB_FLAG_CREATE);
- osi_assert(fidp);
+ osi_assertx(fidp, "null smb_fid_t");
cm_HoldUser(userp);
{
/* this is fatal - log as much as possible */
osi_Log1(smb_logp, "Fatal: NCBevents idx [ %d ] out of range.\n", idx);
- osi_assert(0);
+ osi_assertx(0, "invalid index");
}
thrd_ResetEvent(NCBevents[idx]);
{
/* this is fatal - log as much as possible */
osi_Log1(smb_logp, "Fatal: session idx [ %d ] out of range.\n", idx_session);
- osi_assert(0);
+ osi_assertx(0, "invalid index");
}
/* Get an NCB */
{
/* this is fatal - log as much as possible */
osi_Log1(smb_logp, "Fatal: idx_NCB [ %d ] out of range.\n", idx_NCB);
- osi_assert(0);
+ osi_assertx(0, "invalid index");
}
/* Link them together */
{
/* this is fatal - log as much as possible */
osi_Log1(smb_logp, "Fatal: idx_NCB %d out of range.\n", idx_NCB);
- osi_assert(0);
+ osi_assertx(0, "invalid index");
}
ncbp = NCBs[idx_NCB];
int i;
char eventName[MAX_PATH];
- osi_assert( idx < (sizeof(NCBs) / sizeof(NCBs[0])) );
+ osi_assertx( idx < (sizeof(NCBs) / sizeof(NCBs[0])), "invalid index" );
NCBs[idx] = GetNCB();
sprintf(eventName,"NCBavails[%d]", idx);
* we should probably want to wait for a session to be freed in case
* we run out.
*/
- osi_assert(session < SESSION_MAX - 1);
- osi_assert(numNCBs < NCB_MAX - 1); /* if we pass this test we can allocate one more */
+ osi_assertx(session < SESSION_MAX - 1, "invalid session");
+ osi_assertx(numNCBs < NCB_MAX - 1, "invalid numNCBs"); /* if we pass this test we can allocate one more */
lock_ObtainMutex(&vcp->mx);
vcp->session = session;
}
}
- osi_assert(lana_list.length >= 0);
+ osi_assertx(lana_list.length >= 0, "empty lana list");
if (!lana_found) {
afsi_log("No valid LANA numbers found!");
lana_list.length = 0;
continue;
phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_Listener,
(void*)lana_list.lana[i], 0, &lpid, "smb_Listener");
- osi_assert(phandle != NULL);
+ osi_assertx(phandle != NULL, "smb_Listener thread creation failure");
thrd_CloseHandle(phandle);
}
}
#ifndef DJGPP
phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_ClientWaiter,
NULL, 0, &lpid, "smb_ClientWaiter");
- osi_assert(phandle != NULL);
+ osi_assertx(phandle != NULL, "smb_ClientWaiter thread creation failure");
thrd_CloseHandle(phandle);
#endif /* !DJGPP */
phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_ServerWaiter,
NULL, 0, &lpid, "smb_ServerWaiter");
- osi_assert(phandle != NULL);
+ osi_assertx(phandle != NULL, "smb_ServerWaiter thread creation failure");
thrd_CloseHandle(phandle);
for (i=0; i<smb_NumServerThreads; i++) {
phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_Server,
(void *) i, 0, &lpid, "smb_Server");
- osi_assert(phandle != NULL);
+ osi_assertx(phandle != NULL, "smb_Server thread creation failure");
thrd_CloseHandle(phandle);
}
phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_Daemon,
NULL, 0, &lpid, "smb_Daemon");
- osi_assert(phandle != NULL);
+ osi_assertx(phandle != NULL, "smb_Daemon thread creation failure");
thrd_CloseHandle(phandle);
phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_WaitingLocksDaemon,
NULL, 0, &lpid, "smb_WaitingLocksDaemon");
- osi_assert(phandle != NULL);
+ osi_assertx(phandle != NULL, "smb_WaitingLocksDaemon thread creation failure");
thrd_CloseHandle(phandle);
#ifdef DJGPP