SQLite

Check-in [0367a4d586]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Size optimization in the authorizer error message generation logic.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0367a4d58682a64d7ed4c5a4b4377899e22432851587c649d419efb6d7bac250
User & Date: drh 2017-08-17 18:54:27.587
Context
2017-08-17
19:23
Small optimization in the Expr tree walker. (check-in: 264a5e1b75 user: drh tags: trunk)
18:54
Size optimization in the authorizer error message generation logic. (check-in: 0367a4d586 user: drh tags: trunk)
18:23
In sqlite3ViewGetColumnNames(), return the number of errors, not an error code. (check-in: f13682ea23 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/auth.c.
114
115
116
117
118
119
120

121
122
123
124
125
126
127
128
129
130
131
132
  if( db->init.busy ) return SQLITE_OK;
  rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext
#ifdef SQLITE_USER_AUTHENTICATION
                 ,db->auth.zAuthUser
#endif
                );
  if( rc==SQLITE_DENY ){

    if( db->nDb>2 || iDb!=0 ){
      sqlite3ErrorMsg(pParse, "access to %s.%s.%s is prohibited",zDb,zTab,zCol);
    }else{
      sqlite3ErrorMsg(pParse, "access to %s.%s is prohibited", zTab, zCol);
    }
    pParse->rc = SQLITE_AUTH;
  }else if( rc!=SQLITE_IGNORE && rc!=SQLITE_OK ){
    sqliteAuthBadReturnCode(pParse);
  }
  return rc;
}








>
|
<
<
|
<







114
115
116
117
118
119
120
121
122


123

124
125
126
127
128
129
130
  if( db->init.busy ) return SQLITE_OK;
  rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext
#ifdef SQLITE_USER_AUTHENTICATION
                 ,db->auth.zAuthUser
#endif
                );
  if( rc==SQLITE_DENY ){
    char *z = sqlite3_mprintf("%s.%s", zTab, zCol);
    if( db->nDb>2 || iDb!=0 ) z = sqlite3_mprintf("%s.%z", zDb, z);


    sqlite3ErrorMsg(pParse, "access to %z is prohibited", z);

    pParse->rc = SQLITE_AUTH;
  }else if( rc!=SQLITE_IGNORE && rc!=SQLITE_OK ){
    sqliteAuthBadReturnCode(pParse);
  }
  return rc;
}