Trove Root-disable Code Analysis

Source: Internet
Author: User

Trove version

Git show headcommit f644fdcdb5695de53422ea27bce19f4262413d9emerge:7d219aa 9f17051author:jenkins <[email protected ]>date:thu Jan 02:10:02 +0000 Merge "Add i18n translation to others 1/3"

Source

# trove/guestagent/datastore/mysql_common/service.py 1084 Line def disable_root (self): "", Reset the root password to        An unknown value. "" "Self.enable_root (Root_password=none)

Disable_root call Enable_root set root password to random password

Source

# trove/guestagent/datastore/mysql_common/service.py 1051 Line def enable_root (self, Root_password=none): "" "Enable        The root user global access and/or reset the root password. "" "User = models. Mysqluser.root (Password=root_password) ...

Models. Mysqluser Code

# trove/common/db/mysql/models.py 121 Line Class Mysqluser (models.    Datastoreuser): "" "represents a MySQL User and its associated properties." " Not_supported_chars = Re.compile ("^\s|\s$|" | \"|;| ' |,|/|\\\\ ') def _is_valid_string (self, value): ...

Models. Mysqluser.root inherited from Models.datastoreuser

Models. Datastoreuser.root Code

# trove/common/db/models.py 229 line Class datastoreuser (datastoremodelsbase):      "" "Represents a datastore user" "" "     _HOSTNAME_WILDCARD =  '% '     root_username =  ' Root ' ...     @classmethod     def root (cls, name=none,  Password=none, *args, **kwargs):        if not  Name:            name = cls.root_ username        if not password:             password = utils.generate_random_password ()          user = cls (Name, password, *args, **kwargs)         user.make_root ()     &Nbsp;   return user 

You can see from the code that when password is none, a password is randomly generated for password, so trove root-show will still show root is enable after Trove root-disable.

This article is from the "Wuling Grassland" blog, please make sure to keep this source http://penguintux.blog.51cto.com/3021117/1893196

Trove Root-disable Code Analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.