Skip to content

Commit

Permalink
codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
alanking committed Sep 13, 2023
1 parent e9dc738 commit aa0fad7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
10 changes: 0 additions & 10 deletions scripts/irods/test/test_iadmin_set_grid_configuration.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
from __future__ import print_function

import copy
import json
import os
import tempfile
import textwrap
import unittest

from . import session
from .. import lib
from .. import test
from ..configuration import IrodsConfig
from ..controller import IrodsController
from ..core_file import temporary_core_file
from ..test.command import assert_command


class test_get_grid_configuration(unittest.TestCase):
Expand Down
9 changes: 0 additions & 9 deletions scripts/irods/test/test_pam_password.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
from __future__ import print_function

import copy
import json
import os
import tempfile
import textwrap
import unittest

from . import session
from .. import lib
from .. import test
from ..configuration import IrodsConfig
from ..controller import IrodsController
from ..core_file import temporary_core_file
from ..test.command import assert_command


class test_set_grid_configuration(unittest.TestCase):
Expand Down
20 changes: 8 additions & 12 deletions server/api/src/rsGetLimitedPassword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,22 @@ int
_rsGetLimitedPassword( rsComm_t *rsComm,
getLimitedPasswordInp_t *getLimitedPasswordInp,
getLimitedPasswordOut_t **getLimitedPasswordOut ) {
int status;
getLimitedPasswordOut_t *myGetLimitedPasswordOut;

myGetLimitedPasswordOut = ( getLimitedPasswordOut_t* )malloc( sizeof( getLimitedPasswordOut_t ) );

// parse here to convert to seconds. This is a double-parse situation, but the interface is maintained.
const auto ttl_str = fmt::format(
"{}{}", getLimitedPasswordInp->ttl, getLimitedPasswordInp->unused1 ? getLimitedPasswordInp->unused1 : "h");

int ttl = convert_time_str_to_epoch_seconds(ttl_str.c_str());

const int ttl = convert_time_str_to_epoch_seconds(ttl_str.c_str());
if (ttl < 0) {
return ttl;
}

status = chlMakeLimitedPw(rsComm, ttl, myGetLimitedPasswordOut->stringToHashWith);
if ( status < 0 ) {
rodsLog( LOG_NOTICE,
"_rsGetLimitedPassword: getLimitedPassword, status = %d",
status );
getLimitedPasswordOut_t *myGetLimitedPasswordOut;
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory, cppcoreguidelines-no-malloc)
myGetLimitedPasswordOut = static_cast<getLimitedPasswordOut_t*>(std::malloc( sizeof( getLimitedPasswordOut_t ) ));

const int status = chlMakeLimitedPw(rsComm, ttl, myGetLimitedPasswordOut->stringToHashWith);
if ( status < 0) {
rodsLog( LOG_NOTICE, "_rsGetLimitedPassword: getLimitedPassword, status = %d", status );
}

*getLimitedPasswordOut = myGetLimitedPasswordOut;
Expand Down

0 comments on commit aa0fad7

Please sign in to comment.