RasAdminUserSetInfo throws exception when called for a newly created user

RasAdminUserSetInfo throws exception when called for a newly created user

Post by Amit D. Chaudhar » Fri, 25 Dec 1998 04:00:00



RasAdminUserSetInfo is throwing an exception when it is called for a newly
created user. It does succeeds in updating the settings for the user.

Also, this does not happen, if the dialin dialog is viewed from user manager
and then this call is made. Even if the user has been just created.

I have checked tha parameters and they are correct.

Can someone advise onto why this happens?

Thanks
Amit

 
 
 

RasAdminUserSetInfo throws exception when called for a newly created user

Post by Felix Kasza [MV » Fri, 25 Dec 1998 04:00:00


Amit,

 > RasAdminUserSetInfo is throwing an exception when
 > it is called for a newly created user.

RAS info is kept in one of the reserved fields in the user record. I
imagine that RAUSI() doesn't like seeing garbage in there. I don't know
whether User Manager preinitializes this field, or whether it just
handles the exception from RAUSI() and blithely goes on its way.

--

Cheers,

Felix.

If you post a reply, kindly refrain from emailing it, too.

No anti-spam address here. Just one comment: IN YOUR FACE!

 
 
 

RasAdminUserSetInfo throws exception when called for a newly created user

Post by Amit D. Chaudhar » Sun, 27 Dec 1998 04:00:00


Pardon my igorance, what is RAUSI?

Even I tried making the fields null, etc. This did not work. Also, I found
another case where the API throws an exception, when it is tried on a domain
where I am not a admin. But this might again be due to the fact that it was
a user who dialin dialog box was never brought on.

Another thing, I had to use
extern 'C'
{
    #include <rassapi.h>

Quote:}

to be able to use it in my cpp program.

Thanks
Amit


>Amit,

> > RasAdminUserSetInfo is throwing an exception when
> > it is called for a newly created user.

>RAS info is kept in one of the reserved fields in the user record. I
>imagine that RAUSI() doesn't like seeing garbage in there. I don't know
>whether User Manager preinitializes this field, or whether it just
>handles the exception from RAUSI() and blithely goes on its way.

>--

>Cheers,

>Felix.

>If you post a reply, kindly refrain from emailing it, too.

>No anti-spam address here. Just one comment: IN YOUR FACE!

 
 
 

RasAdminUserSetInfo throws exception when called for a newly created user

Post by Amit D. Chaudhar » Sun, 27 Dec 1998 04:00:00


Ok, RAUSI = RasAdminUserSetInfo. :))
Hit me a little late. What about the rest?

Thanks
Amit


>Pardon my igorance, what is RAUSI?

>Even I tried making the fields null, etc. This did not work. Also, I found
>another case where the API throws an exception, when it is tried on a
domain
>where I am not a admin. But this might again be due to the fact that it was
>a user who dialin dialog box was never brought on.

 
 
 

RasAdminUserSetInfo throws exception when called for a newly created user

Post by Amit D. Chaudhar » Sun, 27 Dec 1998 04:00:00


Hi again,

I tried a few things, mostly getting ideas from your hint.

If it is a 'fresh' user(implies, no one has set his dialin info), the
user_params field obtained using NetUsetGetInfo is empty (usri2_parms of
USER_INFO_2).

After the dialin information is set, this field has a proper string. After
playing around, I found another way of setting RAS info(headers in
rassapi.h)
The RasAdminSetUserParms() returns a user_params field on being passed a
PRAS_USER_0 structure. Then if I pass this  field to NetUserSetInfo, bingo
the dialin property is set properly. Whether it is a fresh user or one for
whom the dialin property is being set properly.

Strange, but a I believe this is the case of a sanity check(string empty
check) missing in the rassapi.dll code. Irritating..., specially after the
hours put in to just find this.

Thanks for the support Felix.

Regards
Amit

 
 
 

RasAdminUserSetInfo throws exception when called for a newly created user

Post by Felix Kasza [MV » Sun, 27 Dec 1998 04:00:00


Amit,

First, sorry about the RAUSI() confusion -- when I've typed one of those
ungainly API names once, I usually mutilate it, out of sheer laziness.

 > The RasAdminSetUserParms() returns a user_params field on being passed a
 > PRAS_USER_0 structure.

And that's the contents of the reserved parms field in the user info, as
you found out in the meantime. Going back to my original post, I notice
that I didn't point you to this; sorry!

--

Cheers,

Felix.

If you post a reply, kindly refrain from emailing it, too.

No anti-spam address here. Just one comment: IN YOUR FACE!

 
 
 

1. RasAdminsUserSetInfo throws exception with newly created user

Hi,

I am using the function "RasAdminUserSetInfo" of RASSAPI.DLL.
If on the PC is a RASSAPI.DLL from february 1998, the function works
correct. If the RASSAPI.DLL is from october 1998, the function causes an
"unhandled exception" in MSVCRT.DLL (SBHEAP.C line 349).

With my program I want to create a new user on my machine or in the domain.

If I create a new user with the user manager (write only a username and full
name and don't open the Dialin dialog)
and then run my progam to add additional features ( Dialin ) the error
appears.

If i create a new user with the user manager  open the Dialin dialog and
change an entry and click OK and then run my program no errors appears.

I think it its an initialize problem.

On my machine and on the server are Win NT 4.0 SP 4.
My development enviroment is VS 6.0 SP 1

Here is an extract of the relevant part of my code :

char ServerName[256];
RAS_USER_0 * pRasUser0;

pRasUser0 = (RAS_USER_0 *)new BYTE[sizeof(RAS_USER_0)];

pRasUser0->bfPrivilege = RASPRIV_DialinPrivilege |
                         RASPRIV_AdminSetCallback;

wcscpy(pRasUser0->szPhoneNumber,A2W("1234"));

RasAdminGetUserAccountServer(A2CW(pCOptionImport->m_strDomainName),
     A2CW(pCOptionImport->GetServerName()),
             (LPWSTR)ServerName );

dwReturn = RasAdminUserSetInfo(A2CW(ServerName),lpwUserName,pRasUser0 );

delete pRasUser0;

Any help is appreciated ...

Toni

2. FS: 2.5" HD and 4-Meg SIMM

3. Throwing exceptions in dtors called by thrown exceptions

4. which FP is best?

5. RASAdminUserSetInfo generates exception if used after NetUserAdd?

6. Canon LBP 465

7. C++ Exceptions: throw vs. throw new

8. Crillee Font .. Seen on the Net?

9. Exceptions are good...but to throw or not to throw is the problem

10. : User interrupt to throw an exception

11. create exception before it is thrown

12. DlgDirList Win32 API call caused exception thrown

13. Multi OLE call problems ("Server threw an exception")