Skip to content

Commit

Permalink
Second stage of fixes for gcc 7 as per davidlt.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Jan 16, 2017
1 parent 1e2f169 commit 91a7680
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 37 deletions.
3 changes: 2 additions & 1 deletion src/XrdCns/XrdCnsDaemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ void XrdCnsDaemon::getEvents(XrdOucStream &Events, const char *Who)
evP->setSize(Size);
break;
case XrdCnsLogRec::lrMkdir:
evP->setSize(-1);
case XrdCnsLogRec::lrCreate:
if (evP->Type() == XrdCnsLogRec::lrMkdir)
evP->setSize(-1);
if (!(tp=Events.GetToken())) {Miss = "mode"; break;}
Mode = strtol(tp, &etp, 8);
if (*etp) {Miss = "mode"; break;}
Expand Down
27 changes: 14 additions & 13 deletions src/XrdCns/XrdCnsLogRec.hh
Original file line number Diff line number Diff line change
Expand Up @@ -149,32 +149,33 @@ inline int setLfn2(const char *lfn)
return n;
}

inline void setMode(mode_t Mode) {char Save = *Rec.Data.SorT;
inline void setMode(mode_t Mode) {char mBuff[8];
Rec.Hdr.Mode = Mode;
snprintf(Rec.Data.Mode,
sizeof(Rec.Data.Mode), "%03o",
snprintf(mBuff,sizeof(mBuff),"%03o",
511 & static_cast<int>(Mode));
*Rec.Data.SorT = Save;
memcpy(Rec.Data.Mode, mBuff,
sizeof(Rec.Data.Mode));
}

inline void setMount(char mCode) {Rec.Data.Mount = mCode;}

inline void setSize(long long Size) {char Save = Rec.Data.Mount;
inline void setSize(long long Size) {char tBuff[24];
Rec.Hdr.Size = Size;
snprintf(Rec.Data.SorT,
sizeof(Rec.Data.SorT), "%12lld",
snprintf(tBuff, sizeof(tBuff),
"%12lld",
(Size > 0 ? Size & 0x7fffffffffLL
: Size));
Rec.Data.Mount = Save;
memcpy(Rec.Data.SorT, tBuff,
sizeof(Rec.Data.SorT));
}

inline void setSpace(char sCode) {Rec.Data.Space = sCode;}

inline void setTime(long TOD=time(0)){char Save = Rec.Data.Mount;
snprintf(Rec.Data.SorT,
sizeof(Rec.Data.SorT), "%12ld",
TOD-tBase);
Rec.Data.Mount = Save;
inline void setTime(long TOD=time(0)){char tBuff[24];
snprintf(tBuff, sizeof(tBuff),
"%12ld", TOD-tBase);
memcpy(Rec.Data.SorT, tBuff,
sizeof(Rec.Data.SorT));
}

inline void setType(const char evt) {Rec.Data.Type = evt;}
Expand Down
4 changes: 2 additions & 2 deletions src/XrdCns/XrdCnsSsi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ void XrdCnsSsi::ApplyLogRec(char *lP)
theDir->Files->Del(fnP);
break;
case XrdCnsLogRec::lrRmdir: hInv->Del(lfn); break;
case XrdCnsLogRec::lrMv: if (AddDel(lfn, lP)) break;
default: if (fnP) *(fnP -1) = '/';
default: if (Type == XrdCnsLogRec::lrMv && AddDel(lfn, lP)) break;
if (fnP) *(fnP -1) = '/';
Say.V("Invalid log record ", lP);
nErrs++;
}
Expand Down
25 changes: 19 additions & 6 deletions src/XrdSecpwd/XrdSecProtocolpwd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,11 @@ XrdSecCredentials *XrdSecProtocolpwd::getCredentials(XrdSecParameters *parm,
nextstep = kXPC_none;
switch (hs->Step) {

case kXPS_init:
case kXPS_init: // The following 3 cases may fall through
case kXPS_puk:
case kXPS_signedrtag: // (after kXRC_verifysrv)
if (hs->Step == kXPS_init)
{
//
// Add bucket with cryptomod to the global list
// (This must be always visible from now on)
Expand All @@ -1009,8 +1013,10 @@ XrdSecCredentials *XrdSecProtocolpwd::getCredentials(XrdSecParameters *parm,
// We set some options in the option field of a pwdStatus_t structure
if (hs->Tty || (AutoLogin > 0))
SessionSt.options = kOptsClntTty;

case kXPS_puk:
}
// case kXPS_puk:
if (hs->Step == kXPS_puk)
{
// After auto-reg request, server puk have been saved in ParseClientInput:
// we need to start a full normal login now

Expand All @@ -1037,8 +1043,10 @@ XrdSecCredentials *XrdSecProtocolpwd::getCredentials(XrdSecParameters *parm,
break;
}
}

case kXPS_signedrtag: // (after kXRC_verifysrv)
}
// case kXPS_signedrtag: // (after kXRC_verifysrv)
if (hs->Step == kXPS_signedrtag)
{
//
// Add the username
if (hs->User.length()) {
Expand Down Expand Up @@ -1073,6 +1081,7 @@ XrdSecCredentials *XrdSecProtocolpwd::getCredentials(XrdSecParameters *parm,
SessionSt.options |= kOptsChngPwd;
//
nextstep = kXPC_normal;
}
break;

case kXPS_credsreq:
Expand Down Expand Up @@ -1350,6 +1359,9 @@ int XrdSecProtocolpwd::Authenticate(XrdSecCredentials *cred,
break;

case kXPC_normal:
case kXPC_creds:
if (hs->Step == kXPC_normal)
{
//
// Complete login sequence: check user and creds
if (QueryUser(entst,ClntMsg) != 0)
Expand Down Expand Up @@ -1378,8 +1390,9 @@ int XrdSecProtocolpwd::Authenticate(XrdSecCredentials *cred,
}
// Creds, if any, should be checked, unles we allow auto-registration
savecreds = (entst != kPFE_allowed) ? 0 : 1;
}

case kXPC_creds:
// case kXPC_creds: (falls into here from _normal)
//
// Final login sequence: extract and check creds
// Extract credentials from main buffer
Expand Down
11 changes: 5 additions & 6 deletions src/XrdSecpwd/XrdSecpwdSrvAdmin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,9 @@ int main( int argc, char **argv )

switch (Action) {
case kA_update:
//
// Like 'add', forcing write
Force = 1;
case kA_add:
if (Action == kA_update) Force = 1;
//
// Add / Update entry
//
Expand Down Expand Up @@ -967,15 +966,15 @@ int main( int argc, char **argv )
break;

case kA_trim:
//
// Trim the file
ff.Trim();

case kA_browse:
default:
//
// Trim the file first before browsing
if (Action == kA_trim) ff.Trim();
//
// Browse
ff.Browse();
break;
}

exit(0);
Expand Down
23 changes: 14 additions & 9 deletions src/XrdXml/tinyxmlparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,30 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng

output += *length;

// Scary scary fall throughs.
switch (*length)
{
case 4:
// Scary scary fall throughs. Reworked as if's for C++17
if (*length == 4)
{ // case 4:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
case 3:
input >>= 6;
}
if (*length >= 3 && *length <= 4)
{ // case 3:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
case 2:
}
if (*length >= 2 && *length <= 4)
{ // case 2:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
case 1:
}
if (*length >= 1 && *length <= 4)
{ // case 1:
--output;
*output = (char)(input | FIRST_BYTE_MARK[*length]);
}
}
}


Expand Down

0 comments on commit 91a7680

Please sign in to comment.