Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

suspended_login value with UAPI list_pops

Discussion in 'cPanel Developers' started by AndyB78, Aug 16, 2017.

Tags:
  1. AndyB78

    AndyB78 Well-Known Member

    Joined:
    Oct 7, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Romania
    Hello,

    I am working on an app and I found out that upon suspending a cPanel account, already suspended email accounts within that suspended cPanel account will be returned as NOT suspended by uapi / list_pops. At least in ver 64.0.36.

    Is this a feature or a bug?

    Steps to reproduce:

    1. #uapi --user=blablate Email list_pops regex=office@blablatest.com
    ---
    apiversion: 3
    func: list_pops
    module: Email
    result:
    data:
    -
    email: office@blablatest.com
    login: office@blablatest.com
    suspended_incoming: 0
    suspended_login: 1
    errors: ~
    messages: ~
    metadata:
    transformed: 1
    status: 1

    2. Suspending cPanel account from WHM or uapi...

    3. #uapi --user=blablate Email list_pops regex=office@blablatest.com
    ---
    apiversion: 3
    func: list_pops
    module: Email
    result:
    data:
    -
    email: office@blablatest.com
    login: office@blablatest.com
    suspended_incoming: 0
    suspended_login: 0
    errors: ~
    messages: ~
    metadata:
    transformed: 1
    status: 1

    Regards!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I've been unable to reproduce this issue on a test system. Can you confirm that you are suspending the email login for the specific email account, as opposed to suspending the entire cPanel account? EX:

    Code:
    uapi --user=username Email suspend_login email=test1%40domain.tld
    Thank you.
     
  3. AndyB78

    AndyB78 Well-Known Member

    Joined:
    Oct 7, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Romania
    Hi,

    First I suspend the email login and I test it's suspended:
    #uapi --user=blablate Email list_pops regex=office@blablatest.com
    ...
    suspended_login: 1

    Then merely after I suspend the entire cPanel account from WHM, the status of the email login suspension changes to
    suspended_login: 0

    Then, if I merely unsuspend the cPanel account, the suspended email login status returns (suspended_login: 1).

    Regards!
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  5. AndyB78

    AndyB78 Well-Known Member

    Joined:
    Oct 7, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Romania
    Hi,

    Thanks for the link. I am still struggling to understand why it's intended behavior for uapi to give inaccurate info on a suspended email address after the entire cPanel account has also been suspended. As it is, it seems kind of confusing as we can't trust the output of "uapi --user=... Email list_pops" which is accurate only when the cPanel account is NOT suspended and irrelevant when the cPanel account IS suspended. Indeed I can see that this shouldn't be a problem normally (it just messed a bit my app logic).

    It's not a serious issue though...easily fixed with an added test.

    Thanks,
    Regards!
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hi,

    The suspend_login UAPI function works by modifying the email account's entry in the /home/$user/etc/$domain.tld/shadow file. For example, before suspending an email account login, the entry in this file for an email account will look like this:

    Code:
    test1:$1$51ayoqJvg$5OFjmu/JNXANDSCZGfjxF2:17322::::::
    After suspending the email account login, the entry looks like this (notice the added "!!" before the password):

    Code:
    test1:!!$1$51ayoqJvg$5OFjmu/JNXANDSCZGfjxF2:17322::::::
    The list_pops UAPI function determines the email account's suspended login status based on that specific change in the shadow file. When you suspend the entire cPanel account, the entry in the shadow file changes to:

    Code:
    test1:*LOCKED*$1$51ayoqJvg$5OFjmu/JNXANDSCZGfjxF2:17322::::::*LOCKED*
    Thus, the list_pops UAPI function won't detect the suspended status until after the entire cPanel account is unsupended, at which time the individual email account suspension is reactivated.

    Thank you.
     
  7. AndyB78

    AndyB78 Well-Known Member

    Joined:
    Oct 7, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Romania
    Michael,

    Thank you for your clarifications! If uapi can't know this, besides uapi is there any API call or any other command that might retrieve the suspended mail account status while the cPanel account is also suspended?

    I mean WHM does list the suspended email login status even in suspended cPanel accounts. It must find this info somewhere. I've looked a bit in whmapi1 API calls but found nothing relevant.

    Thanks,
    Regards!
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you verify where you are seeing that information in Web Host Manager?

    Thank you.
     
  9. AndyB78

    AndyB78 Well-Known Member

    Joined:
    Oct 7, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Romania
    I mean when we access cPanel from WHM -> List accounts... and then click on the cPanel icon and get redirected to cPanel then go to Email Accounts. There, we can see that the email is login suspended or not, even in suspended cPanel account. If cPanel can get that information, maybe we can too...
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    I'm unable to reproduce that behavior using the following steps:

    1. Suspended an email account.
    2. Suspended the full cPanel account the suspended email account is associated with.
    3. Accessed cPanel and verified no suspension status appears in "Email Accounts".
    4. Confirmed the /home/username/.cpanel/email_accounts.json contains a "suspended_login":0" entry for the suspended email account.
    5. Unsuspended the full cPanel account the suspended email account is associated with.
    6. Confirmed the /home/username/.cpanel/email_accounts.json now contains a "suspended_login":1" entry for the suspended email account.

    Are you using different steps, or is it possible you were viewing cached data?

    Thank you.
     
  11. AndyB78

    AndyB78 Well-Known Member

    Joined:
    Oct 7, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Romania
    It took me a while to figure out what I was doing differently.

    0. Nothing is suspended.
    1. Suspend cPanel account from WHM.
    2. Suspend email account from cPanel.
    ...
    "office": {
    "disk_mtime": 1502735937,
    "diskmtime": 1503004647,
    "diskquota": "262144000",
    "diskused": "64137",
    "suspended_login": 1
    }

    Also the 'suspended login' icon appears in cPanel.

    So my findings were different from yours because I was first suspending the cPanel account and afterwards the email account.

    Also it's funny that if I un-suspend the email account while the cPanel account is still suspended after I un-suspend the cPanel account, the email account returns to the suspended status.

    Anyway for me this is the end of this matter as it's obvious that I can't detect reliably an email account status while the containing cPanel account is suspended.

    Thank you! I appreciate your help and patience!
     
Loading...

Share This Page