Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-12197

Two functions to validate session

XMLWordPrintable

    • Sprint 8
    • 2

      After ZBX-9425 and ZBXNEXT-1675 we ended up with

      static zbx_user_type_t	zbx_session_access_level(const char *sessionid)

      in src/zabbix_server/trapper/trapper.c used for "queue.get" and "status.get" and

      int	DBget_user_by_active_session(zbx_user_t *user, const char *sessionid)

      in src/libs/zbxdbhigh/db.c used for global script execution with almost identical functionality.

      Look at SQL queries they have inside (and try to spot differences ):

      	result = DBselect(
      			"select u.type"
      			" from users u,sessions s"
      			" where u.userid=s.userid"
      				" and s.status=%d"
      				" and s.sessionid='%s'",
      			ZBX_SESSION_ACTIVE, sessionid_esc);
      
      	result = DBselect(
      		"select u.userid,u.type"
      			" from sessions s,users u"
      		" where s.userid=u.userid"
      			" and s.sessionid='%s'"
      			" and s.status=%d",
      		sessionid, ZBX_SESSION_ACTIVE);
      

      For the sake of code maintainability, only one of them should survive.

            Unassigned Unassigned
            glebs.ivanovskis Glebs Ivanovskis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: