Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Tuesday, March 20, 2012

Applying SP4. Do you have to provide sa password?

I have never applied a service pack to sql server 2000. Someone tells me that you have an option of supplying the SA password but do not have to and the service pack is applied just as if you did supply the SA password. This sounds odd to me. So, is it true? I am asking because our server instance shows "SP4" but a fix that was supposed to be included in SP4 was apparently not as the problem persists (link from sql server 2005 to 2000 fails when referenced in sql2005). I was thinking that whoever ran the service pack may not have provided the SA password so some of the SP4 was not applied?

Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "s-1". The provider supports the interface, but returns a failure code when it is used.

Thanks.

The service pack ask for the password, It allows to continue without a password, and it provides a notice about the dangers of so doing.

So yes, the service pack may have been properly applied without a password -IF the sa account did not have a password.

|||

There are two ways to log into a SQL Server. One is by specifing a login and password, such as the "sa" login. The other is by using the Windows Creditentials which the user has logged into the operating system with. When installing the service pack you have the option of logging in with which ever method you would like to; either the "sa" account or the Windows account.

What command is being performed when this error comes up?

|||

The above errors arise when trying to issue a select statement on the 2005 server which references tables on the 2000 server which it is linked to. I thought perhaps the person who applied the service pack 4 may not have done it correctly. I was not there, and have never done it myself. The message may imply missing components.

ex. On 2005 server: Select * From linked2000server.mydb.dbo.mytable

|||

Can you query any tables over the linked server, or is this one the only one causing the problem?

If it's every table a sp4 reinstall may be in order on the SQL 2000 server.

|||Nope!

Applying SP4. Do you have to provide sa password?

I have never applied a service pack to sql server 2000. Someone tells me that you have an option of supplying the SA password but do not have to and the service pack is applied just as if you did supply the SA password. This sounds odd to me. So, is it true? I am asking because our server instance shows "SP4" but a fix that was supposed to be included in SP4 was apparently not as the problem persists (link from sql server 2005 to 2000 fails when referenced in sql2005). I was thinking that whoever ran the service pack may not have provided the SA password so some of the SP4 was not applied?

Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "s-1". The provider supports the interface, but returns a failure code when it is used.

Thanks.

The service pack ask for the password, It allows to continue without a password, and it provides a notice about the dangers of so doing.

So yes, the service pack may have been properly applied without a password -IF the sa account did not have a password.

|||

There are two ways to log into a SQL Server. One is by specifing a login and password, such as the "sa" login. The other is by using the Windows Creditentials which the user has logged into the operating system with. When installing the service pack you have the option of logging in with which ever method you would like to; either the "sa" account or the Windows account.

What command is being performed when this error comes up?

|||

The above errors arise when trying to issue a select statement on the 2005 server which references tables on the 2000 server which it is linked to. I thought perhaps the person who applied the service pack 4 may not have done it correctly. I was not there, and have never done it myself. The message may imply missing components.

ex. On 2005 server: Select * From linked2000server.mydb.dbo.mytable

|||

Can you query any tables over the linked server, or is this one the only one causing the problem?

If it's every table a sp4 reinstall may be in order on the SQL 2000 server.

|||Nope!sql

Wednesday, March 7, 2012

Application Roles ENCRYPT function Valid Password Characters

When I try to use the ODBC canonical ENCRYPT function for SP_SETAPPROLE, I
get an ODBC error when certain otherwise good characters are used in the
password. What characters are and are not allowed for passwords for
application roles while using the ENCRYPT function?You might ask me what is a good password? Here is a sample:
wZ726BcF_vR?goLVmxgsGLkZpqQbZ<Yfu<?L<t
RQzCa85c?"DXtI,QPbUtIyBSJbqF?
(without the line return)
"Chuck Hawkins" <charles.hawkins@.NOSPAMjenzabar.net> wrote in message
news:ebySvpBfFHA.3944@.TK2MSFTNGP10.phx.gbl...
> When I try to use the ODBC canonical ENCRYPT function for SP_SETAPPROLE, I
> get an ODBC error when certain otherwise good characters are used in the
> password. What characters are and are not allowed for passwords for
> application roles while using the ENCRYPT function?
>|||You can find the valid characters in the books online help
topic: Security Rules.
You can find the topic in the index under passwords, rules
for
-Sue
On Tue, 28 Jun 2005 15:49:06 -0400, "Chuck Hawkins"
<charles.hawkins@.NOSPAMjenzabar.net> wrote:

>When I try to use the ODBC canonical ENCRYPT function for SP_SETAPPROLE, I
>get an ODBC error when certain otherwise good characters are used in the
>password. What characters are and are not allowed for passwords for
>application roles while using the ENCRYPT function?
>|||Thank you, Sue. I went back and re-wrote my password generation script to
remove references to the unallowed characters mentioned in Security Rules
for passwords - []{}(),;?*! @..
I'm still having the problem with the ENCRYPT function. I execute:
sp_setapprole
@.rolename = 'TEST',
@.password = {Encrypt N
'ro111гPM0ci?TxmOK
e3qJDtSV?Xrи"S??D
k2?q6L?EvrvI1mOENycWpLvz
jL?3kn'}
--@.password = {Encrypt N 'easy'}
,@.encrypt = 'odbc'
go
And get:
[Microsoft][ODBC SQL Server Driver]Syntax error or access violation
I know I don't have a syntax error (other than an ugly password). When I
switch the TEST app role over to a password of 'easy', it works.
Am I supposed to put braces [] around the password somehow?
So the question remains, what characters are not allowed for passwords? I
know []{}(),;?*! @.. are not, but I don't have any of these.
Chuck
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:99a4c1p6996f5mklnjbq0hhmapjunkv95u@.
4ax.com...
> You can find the valid characters in the books online help
> topic: Security Rules.
> You can find the topic in the index under passwords, rules
> for
> -Sue
> On Tue, 28 Jun 2005 15:49:06 -0400, "Chuck Hawkins"
> <charles.hawkins@.NOSPAMjenzabar.net> wrote:
>
>|||Incidentally, here is the ugly password generation code:
set nocount on
declare @.counter int,
@.password varchar(128),
@.char char(1),
@.charindex int,
@.loop int
/* Unallowed characters:
! = 33
( = 40
) = 41
, = 40
* = 42
; = 59
? = 63
@. = 64
[ = 91
] = 93
{ = 123
} = 125
*/
select @.counter = 1, @.password = ''
while @.counter < 2
begin
--Restrict the password to 0-9, A-Z, and a-z
select @.loop = 1
while @.loop = 1
begin
select @.charindex = convert(int, rand() * 254)
if (@.charindex between 65 and 90 or @.charindex between 97 and 122)
and @.charindex not in (33,40,41,42,59,63,64,91,93,123,125)
--or @.charindex between 161 and 255 or @.charindex between 130 AND 140
select @.loop = 0
end
--Accumulate characters for password string
select @.char = char(@.charindex)
select @.password = @.password + @.char
select @.counter = @.counter + 1
end
while @.counter < 4
begin
--Restrict the password to 0-9, A-Z, and a-z
select @.loop = 1
while @.loop = 1
begin
select @.charindex = convert(int, rand() * 254)
if (@.charindex between 48 and 57 or @.charindex between 65 and 90 or
@.charindex between 97 and 122)
and @.charindex not in (33,40,41,42,59,63,64,91,93,123,125)
--or @.charindex between 161 and 255 or @.charindex between 130 AND 140
select @.loop = 0
end
--Accumulate characters for password string
select @.char = char(@.charindex)
select @.password = @.password + @.char
select @.counter = @.counter + 1
end
while @.counter < 5
begin
--Restrict the password to 0-9
select @.loop = 1
while @.loop = 1
begin
select @.charindex = convert(int, rand() * 254)
if @.charindex between 48 and 57 --or @.charindex between 65 and 90 or
@.charindex between 97 and 122
and @.charindex not in (33,40,41,42,59,63,64,91,93,123,125)
--or @.charindex between 161 and 255 or @.charindex between 130 AND 140
select @.loop = 0
end
--Accumulate characters for password string
select @.char = char(@.charindex)
select @.password = @.password + @.char
select @.counter = @.counter + 1
end
while @.counter < 10
begin
-- Restrict the password to NOT 0-9, A-Z, and a-z
select @.loop = 1
while @.loop = 1
begin
select @.charindex = convert(int, rand() * 254)
if --@.charindex between 48 and 57 or @.charindex between 65 and 90 or
@.charindex between 97 and 122
--or
(@.charindex between 161 and 255 or @.charindex between 130 AND 140)
and @.charindex not in (33,40,41,42,59,63,64,91,93,123,125)
select @.loop = 0
end
--Accumulate characters for password string
select @.char = char(@.charindex)
select @.password = @.password + @.char
select @.counter = @.counter + 1
end
while @.counter < 11
begin
--Restrict the password to 0-9
select @.loop = 1
while @.loop = 1
begin
select @.charindex = convert(int, rand() * 254)
if @.charindex between 48 and 57 --or @.charindex between 65 and 90 or
@.charindex between 97 and 122
and @.charindex not in (33,40,41,42,59,63,64,91,93,123,125)
--or @.charindex between 161 and 255 or @.charindex between 130 AND 140
select @.loop = 0
end
--Accumulate characters for password string
select @.char = char(@.charindex)
select @.password = @.password + @.char
select @.counter = @.counter + 1
end
while @.counter < 129
begin
--Restrict the password to 0-9, A-Z, and a-z
select @.loop = 1
while @.loop = 1
begin
select @.charindex = convert(int, rand() * 254)
if (@.charindex between 48 and 57 or @.charindex between 65 and 90 or
@.charindex between 97 and 122
or @.charindex between 161 and 255 or @.charindex between 130 AND 140)
and @.charindex not in (33,40,41,42,59,63,64,91,93,123,125)
select @.loop = 0
end
--Accumulate characters for password string
select @.char = char(@.charindex)
select @.password = @.password + @.char
select @.counter = @.counter + 1
end
select RTRIM(@.password) AS Password
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:99a4c1p6996f5mklnjbq0hhmapjunkv95u@.
4ax.com...
> You can find the valid characters in the books online help
> topic: Security Rules.
> You can find the topic in the index under passwords, rules
> for
> -Sue
> On Tue, 28 Jun 2005 15:49:06 -0400, "Chuck Hawkins"
> <charles.hawkins@.NOSPAMjenzabar.net> wrote:
>
>|||What I've discovered:
The password characters are not allowed for or the canonical ENCRYPT functio
n does not work with characters with the following ASCII codes:
(33,40,41,42,59,63,64,91,93,123,125,130,
132,133,134,135,136,137,139,161,162,
166,167,168,169,171,172,173,174,175,176,
177,180,182,184,187,188,189,190,191,
215,247)
Further, in order for the ENCRYPT function to work, the password cannot be m
ore than 64 characters (vice 128 allowed in Security Rules).
All that said, it still doesn't work. When I enter the following code, I can
not get the SP_SETAPPROLE to work:
exec sp_dropapprole 'TEST_APPROLE'
go
exec sp_addapprole
@.rolename = 'TEST_APPROLE',
@.password = 'rwq4?37ctEPn0izwhJ6dq
dACSZcfmfia?fWG
'
go
sp_setapprole
@.rolename = 'TEST_APPROLE',
@.password = {Encrypt N 'rwq4?37ctEPn0izwhJ6dq
dACSZc
fmfia?fWG'}
--@.password = {Encrypt N 'easy'}
,@.encrypt = 'odbc'
go
Server: Msg 2764, Level 16, State 1, Procedure sp_setapprole, Line 41
Incorrect password supplied for application role 'TEST_APPROLE'.
So the question remains, what are valid password characters for application
roles in order for the ENCRYPT function to work?
And now we have a new question, why does the ENCRYPT function limit you to 6
4 characters? I have my suppositions but I'd love to hear from someone who k
nows.
Chuck Hawkins
"Chuck Hawkins" <charles.hawkins@.NOSPAMjenzabar.net> wrote in message news:OUXAtKKfFHA.572@.T
K2MSFTNGP15.phx.gbl...
> Thank you, Sue. I went back and re-wrote my password generation script to
> remove references to the unallowed characters mentioned in Security Rules
> for passwords - []{}(),;?*! @..
> I'm still having the problem with the ENCRYPT function. I execute:
>
> sp_setapprole
> @.rolename = 'TEST',
> @.password = {Encrypt N
> 'ro111гPM0ci?TxmOK
e3qJDtSV?Xrи"S??
Dk2?q6L?EvrvI1mOENycWpLv
zjL?3kn'}
> --@.password = {Encrypt N 'easy'}
> ,@.encrypt = 'odbc'
> go
>
> And get:
> [Microsoft][ODBC SQL Server Driver]Syntax error or access violatio
n
>
> I know I don't have a syntax error (other than an ugly password). When I
> switch the TEST app role over to a password of 'easy', it works.
>
> Am I supposed to put braces [] around the password somehow?
>
> So the question remains, what characters are not allowed for passwords? I
> know []{}(),;?*! @.. are not, but I don't have any of these.
>
> Chuck
>
> "Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
> news:99a4c1p6996f5mklnjbq0hhmapjunkv95u@.
4ax.com...
>
>

Monday, February 13, 2012

App login using credentials from SQL table

I'm trying to create a login screen that will verify a user's username and password from within a SQL table. If the credentials are found in the table, they should be sent to a Main Menu screen. If the credentials are not found, I will throw a message on the screen. Does anyone have code to accomplish this? I am at a total standstill.

Thanks,
BoydMCheck out this tutorial to use .NET security features:

http://www.dotnetjunkies.com/quickstart/aspplus/doc/authandauth.aspx

You can expand on that stuff to use the database or if you want to go ad hoc and not use the .NET security features you could always just have them submit their username and password from the form and compare them to values in the database and whether or not they match depends on where they go. Hope this helps.

- Jesse Williams|||Thanks Jesse. I've read a few articles regarding forms-based authentication, but they all seem to use 1 username and password to compare against (For example, if the username entered equals 'john@.abc.com' and the password equals 'password', then process accordingly). In my situation, I want to compare what the user enters against a table of usernames and passwords to verify they have entered valid credentials.

Any ideas?

Thanks,
BoydM|||You could create your username and password tables in the database and write a stored procedure to execute from your application code. Also if you want to base their privlidges I'd add a userRole (Admin, user, etc.) column in too. The store procedure would have three parameters: username, password, and return value (return the role of the user). Here's what I would envision the procedure to look like:


CREATE PROCEDURE GetUserRole
( @.username varchar(25),
@.password varchar(10),
@.userRole varchar(10) OUTPUT
)
AS
BEGIN
IF EXISTS (SELECT userName, password FROM UsersTable WHERE userName = @.userName AND password = @.password)
BEGIN
SELECT @.userRole = userRole FROM UsersTable WHERE userName = @.userName AND password = @.password
RETURN @.userRole
END
ELSE
RETURN -1
END

This is off the top of my head, so I don't know if it's going to run properly. Just configure your SqlCommands in your code to have parameters sending and receiving values and test it out. Anymore help, please post here. Hope this helps. Good luck.

- Jesse Williams|||Thanks. The more I research, the more I'm beginning to realize that I need to use a stored procedure to query the SQL table. I'm fairly new to stored procedures, and even newer to asp.net. A couple questions:
Where do I place the 'CREATE PROCEDURE' code in my aspx.vb file?
Secondly, how do I code my parameters for sending and receiving values?

Thanks again,
BoydM (phellow phan)|||You actually dont place the stored procedure code in your code file. What database are you using? If you are using SQL Server and Enterprise Manager you can use that or Query Analyzer (I prefer Query Analyzer). To create the procedure you would write the code I provided you and execute to create the procedure. This will create the procedure, no need to worry about the create proc stuff anymore. You will execute the proc from your code with the parameters. Here's some code to help you a little more:


'Import SQL Namespace; Required
Import System.Data
Import System.Data.SqlClient

Dim strSQL As String
Dim strConString As String
'Get Connection String From Web.config
strConString = System.Configuration.ConfigurationSettings.AppSettings("sqlCon")
'SQL Statement to execute proc
strSQL = "EXEC GetUserRole"
Dim conSQL As New SqlConnection(strConString)
Dim cmdSqlCommand as New SqlCommand(strSQL, conSQL)
'Add Parameters too command
cmdSqlCommand.Parameters.Add("@.userName", txtUserName.text)
cmdSqlCommand.Parameters.Add("@.password", txtPassword.text)
cmdSqlCommand.Parameters.Add("@.userRole", SqlDbType.VarChar, 10).Direction = ParameterDirection.Output
cmdSqlCommand.Parameters.Add("RETURN_VALUE", SqlDbType.Int, 4).Direction = ParameterDirection.ReturnValue
'Execute the command
cmdSqlCommand.ExecuteNonQuery()
'Retrieve Return Value
. . .
'Do the Rest of your code here
. . .

Again, this is off the top of my head, so some stuff may need fixing. Hope this helps and good luck.

- Jesse Williams

Apologies for half a post below ... as I was asking

How can I find out what appications ( if any ) are connecting to the database
using the sa password. Keeping in mind these are old applications that may
have the uid and pwd hardcoded in them. They are old apps with no
documentation and we, the DBA's are seperate from developers.
Any ideas would be welcome.exec sp_who2
Shows a wealth of good information.
Rick Sawtell
MCT, MCSD, MCDBA
Shou
"MANCPOLYMAN" <MANCPOLYMAN@.discussions.microsoft.com> wrote in message
news:8074B1F2-C889-4A83-852B-F4BAC5C5CD85@.microsoft.com...
> How can I find out what appications ( if any ) are connecting to the
database
> using the sa password. Keeping in mind these are old applications that
may
> have the uid and pwd hardcoded in them. They are old apps with no
> documentation and we, the DBA's are seperate from developers.
> Any ideas would be welcome.|||This is a multi-part message in MIME format.
--=_NextPart_000_008B_01C4ABE7.E14691B0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
You can also use profiler to filter this.
Tunji O
"MANCPOLYMAN" <MANCPOLYMAN@.discussions.microsoft.com> wrote in message =news:8074B1F2-C889-4A83-852B-F4BAC5C5CD85@.microsoft.com...
How can I find out what appications ( if any ) are connecting to the =database using the sa password. Keeping in mind these are old applications =that may have the uid and pwd hardcoded in them. They are old apps with no documentation and we, the DBA's are seperate from developers.
Any ideas would be welcome.
--=_NextPart_000_008B_01C4ABE7.E14691B0
Content-Type: text/html;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

You can also use profiler to filter this.
Tunji O
"MANCPOLYMAN" wrote in message news:807=4B1F2-C889-4A83-852B-F4BAC5C5CD85@.microsoft.com...How can I find out what appications ( if any ) are connecting to the =database using the sa password. Keeping in mind these are old =applications that may have the uid and pwd hardcoded in them. They are =old apps with no documentation and we, the DBA's are seperate from developers.Any ideas would be =welcome.

--=_NextPart_000_008B_01C4ABE7.E14691B0--

Apologies for half a post below ... as I was asking

How can I find out what appications ( if any ) are connecting to the database
using the sa password. Keeping in mind these are old applications that may
have the uid and pwd hardcoded in them. They are old apps with no
documentation and we, the DBA's are seperate from developers.
Any ideas would be welcome.
exec sp_who2
Shows a wealth of good information.
Rick Sawtell
MCT, MCSD, MCDBA
Shou
"MANCPOLYMAN" <MANCPOLYMAN@.discussions.microsoft.com> wrote in message
news:8074B1F2-C889-4A83-852B-F4BAC5C5CD85@.microsoft.com...
> How can I find out what appications ( if any ) are connecting to the
database
> using the sa password. Keeping in mind these are old applications that
may
> have the uid and pwd hardcoded in them. They are old apps with no
> documentation and we, the DBA's are seperate from developers.
> Any ideas would be welcome.
|||You can also use profiler to filter this.
Tunji O
"MANCPOLYMAN" <MANCPOLYMAN@.discussions.microsoft.com> wrote in message news:8074B1F2-C889-4A83-852B-F4BAC5C5CD85@.microsoft.com...
How can I find out what appications ( if any ) are connecting to the database
using the sa password. Keeping in mind these are old applications that may
have the uid and pwd hardcoded in them. They are old apps with no
documentation and we, the DBA's are seperate from developers.
Any ideas would be welcome.