Skip to content

Commit

Permalink
Eliminate preprocessor-disabled dead code
Browse files Browse the repository at this point in the history
It's been policy for a while now not to create "dead hunks" like
these.  A great deal of this code simply doesn't work because it
hasn't been kept up-to-date, and may never have worked.  Eliminate
these dead hunks along with the complexity to support them.
  • Loading branch information
frozencemetery authored and greghudson committed Jul 18, 2018
1 parent d1fb355 commit 2bc951d
Show file tree
Hide file tree
Showing 84 changed files with 23 additions and 1,394 deletions.
6 changes: 0 additions & 6 deletions src/ccapi/common/win/OldCC/ccutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ HANDLE createThreadEvent(char* uuid, char* suffix) {
event_name = allocEventName(uuid, suffix);
if (!event_name) status = cci_check_error(ccErrNoMem);
}
#if 0
cci_debug_printf("%s event_name:%s", __FUNCTION__, event_name);
#endif
if (!status) {
hEvent = CreateEvent(psa, FALSE, FALSE, event_name);
if (!hEvent) status = cci_check_error(GetLastError());
Expand All @@ -125,9 +122,6 @@ HANDLE openThreadEvent(char* uuid, char* suffix) {

event_name = allocEventName(uuid, suffix);
if (!event_name) status = cci_check_error(ccErrNoMem);
#if 0
cci_debug_printf("%s event_name:%s", __FUNCTION__, event_name);
#endif
if (!status) {
hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, event_name);
if (!hEvent) status = cci_check_error(GetLastError());
Expand Down
3 changes: 0 additions & 3 deletions src/ccapi/common/win/OldCC/ccutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif

#define REPLY_SUFFIX (char*)"reply"
#define LISTEN_SUFFIX (char*)"listen"
Expand Down
39 changes: 0 additions & 39 deletions src/ccapi/common/win/OldCC/opts.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,45 +29,6 @@
#include <stdlib.h>
#include <opts.hxx>

#if 0
const struct Opts*
GetOpts(
)
{
bool done = false;
struct Opts* o;
if (!(o = new Opts))
goto cleanup;
if (!(o->pszString = new char[lstrlenA(opts.pszString) + 1]))
goto cleanup;
if (!(o->pszEndpoint = new char[lstrlenA(opts.pszEndpoint) + 1]))
goto cleanup;
strcpy(o->pszString, opts.pszString);
strcpy(o->pszEndpoint, opts.pszEndpoint);
done = true;
cleanup:
if (!done) {
FreeOpts(o);
o = 0;
}
return o;
}

void
FreeOpts(
struct Opts* o
)
{
if (o) {
if (o->pszString)
delete [] o->pszString;
if (o->pszEndpoint)
delete [] o->pszEndpoint;
delete o;
}
}
#endif

bool
ParseOpts::IsValidOpt(
char ch
Expand Down
6 changes: 0 additions & 6 deletions src/ccapi/common/win/OldCC/secure.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ public:
static void Start(SecureClient*& s);
static void Stop(SecureClient*& s);

#if 0
static DWORD CheckImpersonation();
static bool IsImp();
static DWORD DuplicateImpAsPrimary(HANDLE& hPrimary);
#endif

SecureClient();
~SecureClient();
DWORD Error();
Expand Down
3 changes: 0 additions & 3 deletions src/ccapi/common/win/OldCC/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif

BOOL isNT();

Expand Down
39 changes: 0 additions & 39 deletions src/ccapi/lib/win/OldCC/client.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ DWORD find_server(Init::InitInfo& info, LPSTR endpoint) {
char* szDir = 0;
BOOL bRes = FALSE;
char* cmdline = NULL;
#if 0
HANDLE hToken = 0;
#endif

psa = isNT() ? &sa : 0;

Expand Down Expand Up @@ -156,38 +153,6 @@ DWORD find_server(Init::InitInfo& info, LPSTR endpoint) {
}

if (!status) {

#if 0
if (SecureClient::IsImp()) {
cci_debug_printf(STARTUP "Token is impersonation token"));
SecureClient::DuplicateImpAsPrimary(hToken);
}
else {
cci_debug_printf(STARTUP "Token is NOT impersonation token"));
}
#endif

#if 0
if (hToken)
bRes = CreateProcessAsUser(hToken,
szExe, // app name
NULL, // cmd line
psa, // SA
psa, // SA
FALSE,
CREATE_NEW_PROCESS_GROUP |
//CREATE_NEW_CONSOLE |
NORMAL_PRIORITY_CLASS |
// CREATE_NO_WINDOW |
DETACHED_PROCESS |
0
,
NULL, // environment
szDir, // current dir
&si,
&pi);
else
#endif
alloc_cmdline_2_args(szExe, endpoint, "-D", &cmdline);
bRes = CreateProcess( szExe, // app name
NULL, //cmdline, // cmd line is <server endpoint -[DC]>
Expand Down Expand Up @@ -223,10 +188,6 @@ DWORD find_server(Init::InitInfo& info, LPSTR endpoint) {
cci_debug_printf(" unexpected error while looking for server: 0D%d / 0U%u / 0X%X", status, status, status);
}

#if 0
if (hToken)
CloseHandle(hToken);
#endif
if (szDir) free_alloc_p(&szDir);
if (szExe) free_alloc_p(&szExe);
if (hEvent) CloseHandle(hEvent);
Expand Down
15 changes: 0 additions & 15 deletions src/ccapi/lib/win/ccapi_os_ipc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ extern "C" cc_int32 cci_os_ipc_thread_init (void) {
cci_check_error(err);
}

#if 0
cci_debug_printf("%s UUID:<%s>", __FUNCTION__, tspdata_getUUID(ptspdata));
#endif
// Initialize old CCAPI if necessary:
if (!err) if (!Init:: Initialized()) err = Init:: Initialize( );
if (!err) if (!Client::Initialized()) err = Client::Initialize(0);
Expand Down Expand Up @@ -243,10 +240,6 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,
if (!GetTspData(GetTlsIndex(), &ptspdata)) {return ccErrBadParam;}
uuid = tspdata_getUUID(ptspdata);
lenUUID = 1 + strlen(uuid); /* 1+ includes terminating \0. */
#if 0
cci_debug_printf("%s calling remote ccs_rpc_request tsp*:0x%X", __FUNCTION__, ptspdata);
cci_debug_printf(" rpcmsg:%d; UUID[%d]:<%s> SST:%ld", in_msg, lenUUID, uuid, sst);
#endif
/* copy ptr into handle; ptr may be 4 or 8 bytes, depending on platform; handle is always 8 */
memcpy(tspdata_handle, &ptspdata, sizeof(ptspdata));
ccs_rpc_request( /* make call with user message: */
Expand Down Expand Up @@ -282,11 +275,6 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,
if (!err && server_died) {
err = cci_check_error (ccErrServerUnavailable);
}
#if 0
if (err == BOOTSTRAP_UNKNOWN_SERVICE && !in_launch_server) {
err = ccNoError; /* If the server is not running just return an empty stream. */
}
#endif

if (!err) {
*out_reply_stream = tspdata_getStream(ptspdata);
Expand Down Expand Up @@ -365,9 +353,6 @@ cc_int32 ccapi_connect(const struct tspdata* tsp) {
ReleaseMutex(hCCAPIv2Mutex);

if (!status) {
#if 0
cci_debug_printf("%s Waiting for replyEvent.", __FUNCTION__);
#endif
status = WaitForSingleObject(replyEvent, INFINITE);//(SECONDS_TO_WAIT)*1000);
status = cci_check_error(RpcMgmtIsServerListening(CLIENT_REQUEST_RPC_HANDLE));
cci_debug_printf(" Server %sFOUND!", (status) ? "NOT " : "");
Expand Down
8 changes: 2 additions & 6 deletions src/ccapi/lib/win/ccs_reply_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ void ccs_rpc_request_reply(
struct tspdata* tsp;
k5_ipc_stream stream;
long status = 0;
#if 0
cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);
#endif

memcpy(&tsp, tspHandle, sizeof(tsp));
if (!status) {
status = krb5int_ipc_stream_new (&stream); /* Create a stream for the request data */
Expand Down Expand Up @@ -77,9 +75,7 @@ void ccs_rpc_connect_reply(

HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX);
DWORD* p = (DWORD*)(tspHandle);
#if 0
cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);
#endif

SetEvent(hEvent);
CloseHandle(hEvent);
}
Expand Down
12 changes: 1 addition & 11 deletions src/ccapi/lib/win/dllmain.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, // DLL module handle
// using multiple DLLs that use this DLL.
//
WaitForSingleObject( hCCAPIv2Mutex, INFINITE );
#if 0
bool process_teardown_workaround = false;
if (lpvReserved) {
Init::InitInfo info;
status = Init::Info(info);
if (status) break;
if (!info.isNT) process_teardown_workaround = true;
}
if (process_teardown_workaround)
break;
#endif

// return value is ignored, so we set status for debugging purposes
status = Client::Cleanup();
status = Init::Cleanup();
Expand Down
23 changes: 1 addition & 22 deletions src/ccapi/server/win/ccs_os_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,7 @@ cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]) {

if (worklist_remove(&rpcmsg, &pipe, &buf, &serverStartTime)) {
uuid = ccs_win_pipe_getUuid(pipe);
#if 0
cci_debug_printf("%s: processing WorkItem msg:%ld pipeUUID:<%s> pipeHandle:0x%X SST:%ld",
__FUNCTION__, rpcmsg, uuid, ccs_win_pipe_getHandle(pipe), serverStartTime);
#endif

if (serverStartTime <= getMySST()) {
switch (rpcmsg) {
case CCMSG_CONNECT: {
Expand Down Expand Up @@ -472,13 +469,6 @@ void receiveLoop(void* rpcargs) {
} // End receiveLoop


#if 0

return status;
}
#endif



/* ------------------------------------------------------------------------ */
/* The connection listener thread waits forever for a call to the CCAPI_CLIENT_<UUID>
Expand Down Expand Up @@ -647,17 +637,6 @@ RPC_STATUS send_connection_reply(ccs_pipe_t in_pipe) {
return (status);
}

#if 0
DWORD alloc_name(LPSTR* pname, LPSTR postfix) {
DWORD len = strlen(sessID) + 1 + strlen(postfix) + 1;

*pname = (LPSTR)malloc(len);
if (!*pname) return GetLastError();
_snprintf(*pname, len, "%s.%s", sessID, postfix);
return 0;
}
#endif

RPC_STATUS GetPeerName( RPC_BINDING_HANDLE hClient,
LPTSTR pszClientName,
int iMaxLen) {
Expand Down
12 changes: 3 additions & 9 deletions src/ccapi/server/win/ccs_request_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ void ccs_rpc_request(
k5_ipc_stream stream;
UINT64* p = (UINT64*)(tspHandle);
WIN_PIPE* pipe = NULL;
#if 0
cci_debug_printf("%s rpcmsg:%d; UUID:<%s> SST:<%s>", __FUNCTION__, rpcmsg, pszUUID, serverStartTime);
#endif

status = (rpcmsg != CCMSG_REQUEST) && (rpcmsg != CCMSG_PING);

if (!status) {
Expand All @@ -72,9 +70,7 @@ void ccs_rpc_connect(

UINT64* p = (UINT64*)(tspHandle);
WIN_PIPE* pipe = ccs_win_pipe_new(pszUUID, *p);
#if 0
cci_debug_printf("%s; rpcmsg:%d; UUID: <%s>", __FUNCTION__, rpcmsg, pszUUID);
#endif

worklist_add( rpcmsg,
pipe,
NULL, /* No payload with connect request */
Expand All @@ -89,9 +85,7 @@ CC_UINT32 ccs_authenticate(const CC_CHAR* name) {
PDWORD pvalue = 0;
CC_UINT32 result = 0;
DWORD status = 0;
#if 0
cci_debug_printf("%s ( %s )", __FUNCTION__, name);
#endif

hMap = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, (LPSTR)name);
status = !hMap;

Expand Down
4 changes: 1 addition & 3 deletions src/ccapi/server/win/ccs_win_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ struct ccs_win_pipe_t* ccs_win_pipe_new (const char* uuid, const UINT64 h) {
out_pipe->uuid = uuidCopy;
out_pipe->clientHandle = h;
}
#if 0
cci_debug_printf("0x%X = %s(%s, 0x%X)", out_pipe, __FUNCTION__, uuid, h);
#endif

return out_pipe;
}

Expand Down
6 changes: 0 additions & 6 deletions src/ccapi/test/pingtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ int main( int argc, char *argv[]) {

if ((dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE;

// send_test("krbcc.229026.0.ep");

#if 0
err = cc_initialize(&context, ccapi_version_7, NULL, NULL);
#endif

if (!err) {
err = cci_os_ipc_thread_init();
}
Expand Down
17 changes: 0 additions & 17 deletions src/clients/ksu/authorization.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,6 @@ krb5_error_code krb5_authorization(context, principal, luser,
"In krb5_authorization: if auth files exist -> can access\n");
}

#if 0
if (cmd){
if(k5users_flag){
return 0; /* if kusers does not exist -> done */
}else{
if(retval = k5users_lookup(users_fp,princname,
cmd,&retbool,out_fcmd)){
auth_cleanup(users_fp, login_fp, princname);
return retval;
}else{
*ok =retbool;
return retval;
}
}
}
#endif

/* if either file exists,
first see if the principal is in the login in file,
if it's not there check the k5users file */
Expand Down
8 changes: 0 additions & 8 deletions src/config/win-post.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ clean-windows-files:
!else
@if exist $(OUTPRE3)$(DIRNUL) deltree /y $(OUTPRE3)
!endif
!if 0
$(RM) .\$(OUTPRE)*.obj .\$(OUTPRE)*.res
$(RM) .\$(OUTPRE)*.exe .\$(OUTPRE)*.dll
$(RM) .\$(OUTPRE)*.lib .\$(OUTPRE)*.pdb
$(RM) .\$(OUTPRE)*.exp .\$(OUTPRE)*.map
$(RM) .\$(OUTPRE)*.idb .\$(OUTPRE)*.ilk
$(RM) .\$(OUTPRE)*.manifest
!endif

# Dependencies
!if exist($(srcdir)/deps)
Expand Down

0 comments on commit 2bc951d

Please sign in to comment.