Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
084c8a39
Commit
084c8a39
authored
9 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Removed the potential dangerous use of const_cast<char *> from CastorNameServer.cpp
parent
a86d7b9b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nameserver/CastorNameServer.cpp
+9
-9
9 additions, 9 deletions
nameserver/CastorNameServer.cpp
with
9 additions
and
9 deletions
nameserver/CastorNameServer.cpp
+
9
−
9
View file @
084c8a39
...
...
@@ -46,7 +46,7 @@ void cta::CastorNameServer::updateStorageClass(
bzero
(
&
fc
,
sizeof
(
struct
Cns_fileclass
));
strncpy
(
fc
.
name
,
name
.
c_str
(),
CA_MAXCLASNAMELEN
);
fc
.
nbcopies
=
nbCopies
;
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_modifyclass
(
const_cast
<
char
*>
(
m_server
.
c_str
()
)
,
0
,
const_cast
<
char
*>
(
name
.
c_str
()
)
,
&
fc
),
__FUNCTION__
);
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_modifyclass
(
m_server
.
c_str
(),
0
,
name
.
c_str
(),
&
fc
),
__FUNCTION__
);
}
//------------------------------------------------------------------------------
...
...
@@ -60,7 +60,7 @@ void cta::CastorNameServer::createStorageClass(
strncpy
(
fc
.
name
,
name
.
c_str
(),
CA_MAXCLASNAMELEN
);
fc
.
nbcopies
=
nbCopies
;
fc
.
classid
=
time
(
NULL
)
%
10000
;
//should be 5 digits allowed but it actually works only if you provide 4 digits... go figure!
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_enterclass
(
const_cast
<
char
*>
(
m_server
.
c_str
()
)
,
&
fc
),
__FUNCTION__
);
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_enterclass
(
m_server
.
c_str
(),
&
fc
),
__FUNCTION__
);
}
//------------------------------------------------------------------------------
...
...
@@ -82,7 +82,7 @@ void cta::CastorNameServer::createStorageClass(
strncpy
(
fc
.
name
,
name
.
c_str
(),
CA_MAXCLASNAMELEN
);
fc
.
nbcopies
=
nbCopies
;
fc
.
classid
=
id
;
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_enterclass
(
const_cast
<
char
*>
(
m_server
.
c_str
()
)
,
&
fc
),
__FUNCTION__
);
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_enterclass
(
m_server
.
c_str
(),
&
fc
),
__FUNCTION__
);
}
//------------------------------------------------------------------------------
...
...
@@ -90,7 +90,7 @@ void cta::CastorNameServer::createStorageClass(
//------------------------------------------------------------------------------
void
cta
::
CastorNameServer
::
deleteStorageClass
(
const
SecurityIdentity
&
requester
,
const
std
::
string
&
name
)
{
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_deleteclass
(
const_cast
<
char
*>
(
m_server
.
c_str
()
)
,
0
,
const_cast
<
char
*>
(
name
.
c_str
())
)
,
__FUNCTION__
);
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_deleteclass
(
m_server
.
c_str
(),
0
,
name
.
c_str
()),
__FUNCTION__
);
}
//------------------------------------------------------------------------------
...
...
@@ -120,7 +120,7 @@ void cta::CastorNameServer::setDirStorageClass(
const
SecurityIdentity
&
requester
,
const
std
::
string
&
path
,
const
std
::
string
&
storageClassName
)
{
Utils
::
assertAbsolutePathSyntax
(
path
);
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_chclass
(
path
.
c_str
(),
0
,
const_cast
<
char
*>
(
storageClassName
.
c_str
())
)
,
__FUNCTION__
);
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_chclass
(
path
.
c_str
(),
0
,
storageClassName
.
c_str
()),
__FUNCTION__
);
}
//------------------------------------------------------------------------------
...
...
@@ -132,12 +132,12 @@ void cta::CastorNameServer::clearDirStorageClass(
char
no_class
[]
=
"NO_CLASS"
;
struct
Cns_fileclass
fc
;
bzero
(
&
fc
,
sizeof
(
struct
Cns_fileclass
));
if
(
Cns_queryclass
(
const_cast
<
char
*>
(
m_server
.
c_str
()
)
,
0
,
no_class
,
&
fc
))
{
if
(
Cns_queryclass
(
m_server
.
c_str
(),
0
,
no_class
,
&
fc
))
{
bzero
(
&
fc
,
sizeof
(
struct
Cns_fileclass
));
strncpy
(
fc
.
name
,
no_class
,
CA_MAXCLASNAMELEN
);
fc
.
nbcopies
=
0
;
fc
.
classid
=
1
;
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_enterclass
(
const_cast
<
char
*>
(
m_server
.
c_str
()
)
,
&
fc
),
std
::
string
(
__FUNCTION__
)
+
" - Cns_enterclass"
);
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_enterclass
(
m_server
.
c_str
(),
&
fc
),
std
::
string
(
__FUNCTION__
)
+
" - Cns_enterclass"
);
}
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_chclass
(
path
.
c_str
(),
0
,
no_class
),
__FUNCTION__
);
}
...
...
@@ -150,7 +150,7 @@ std::string cta::CastorNameServer::getDirStorageClass(const SecurityIdentity &re
struct
Cns_filestat
statbuf
;
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_stat
(
path
.
c_str
(),
&
statbuf
),
__FUNCTION__
);
struct
Cns_fileclass
cns_fileclass
;
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_queryclass
(
const_cast
<
char
*>
(
m_server
.
c_str
()
)
,
statbuf
.
fileclass
,
NULL
,
&
cns_fileclass
),
__FUNCTION__
);
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_queryclass
(
m_server
.
c_str
(),
statbuf
.
fileclass
,
NULL
,
&
cns_fileclass
),
__FUNCTION__
);
return
cns_fileclass
.
name
;
}
...
...
@@ -235,7 +235,7 @@ std::unique_ptr<cta::ArchiveFileStatus> cta::CastorNameServer::statFile(
const
uint64_t
size
(
statbuf
.
filesize
);
const
Checksum
checksum
(
Checksum
::
CHECKSUMTYPE_ADLER32
,
std
::
string
(
statbuf
.
csumvalue
));
struct
Cns_fileclass
cns_fileclass
;
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_queryclass
(
const_cast
<
char
*>
(
m_server
.
c_str
()
)
,
statbuf
.
fileclass
,
NULL
,
&
cns_fileclass
),
__FUNCTION__
);
exception
::
Serrnum
::
throwOnMinusOne
(
Cns_queryclass
(
m_server
.
c_str
(),
statbuf
.
fileclass
,
NULL
,
&
cns_fileclass
),
__FUNCTION__
);
const
std
::
string
storageClassName
(
cns_fileclass
.
name
);
return
std
::
unique_ptr
<
ArchiveFileStatus
>
(
new
ArchiveFileStatus
(
owner
,
mode
,
size
,
checksum
,
storageClassName
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment