Details

      Description

      We'll move the members "LEX_CSTRING user" and "LEX_CSTRING host" and associated methods from LEX_USER to a separate structure:

      struct AUTHID
      {
        LEX_CSTRING user, host;
        void init() { memset(this, 0, sizeof(*this)); }
        void copy(MEM_ROOT *root, const LEX_CSTRING *usr, const LEX_CSTRING *host);
        bool is_role() const { return user.str[0] && !host.str[0]; }
        void set_lex_string(LEX_CSTRING *l, char *buf)
        {
          if (is_role())
            *l= user;
          else
          {
            l->str= buf;
            l->length= strxmov(buf, user.str, "@", host.str, NullS) - buf;
          }
        }
      };
      

      and derive LEX_USER from it:

      struct LEX_USER: public AUTHID
      {
        LEX_CSTRING plugin, auth;
        LEX_CSTRING pwtext, pwhash;
        void reset_auth()
        {
          pwtext.length= pwhash.length= plugin.length= auth.length= 0;
          pwtext.str= pwhash.str= 0;
          plugin.str= auth.str= "";
        }
      };
      

      This will allow to declare (variables and members) and pass user and host as a single structure.
      Deriving LEX_USER from the new structure AUTHID will minimize code changes.

        Attachments

          Activity

            People

            • Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: